Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling an Event from Another Form

Status
Not open for further replies.

choudhmh

Programmer
Aug 9, 2004
34
GB
Hello Experts!
I have two form, form1 and form2. I'm trying to call an event from form1 into form2, but keep on getting an error. I've made that event from private to public in form1, but still it does not function. Also when the event is recognised by the comppiler, it should open an tabPage, which is also not functionning. Hers the script, can anyone see where i've gone wrong. thanks.


private void button1_Click(object sender, System.EventArgs e)
{
SqlConnection da = new SqlConnection(
@"Data Source= xxxxxxxx;"+
"Initial Catalog = Test;" +
"Network Library=DBMSSOCN;"+
"user id =xxx;"+
"Password=xxxxxx");
da.Open();
SqlCommand thisCommand = da.CreateCommand();
String sQuery = "SELECT Name, LicenseID FROM License WHERE Name = '"+ Form1.textBox1.Text +"'AND LicenseID = '"+ Form1.textBox2.Text +"' ";
SqlCommand cmd = new SqlCommand(sQuery, da);
SqlDataReader dr = cmd.ExecuteReader();
if(dr.Read())
{
tabPage3.Show();
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top