Accessing methods in ControlLibrary
Here's my situation:
I've created a Control Library which contains one usercontrol which contains a button and three textboxes. I've built the solution and have saved the project.
In my Windows application I have a reference to my control library and have included the "using..." statement for my control library.
Now, at runtime I want the ability to drop that usercontrol from my control library and access a method in that class. Make sense????
I can't seem to access the methods of the UserControl1 class in my control library unless I'm referencing the exact usercontrol on my form.
VB Code:
private void button8_Click(object sender, System.EventArgs e)
{
String tn;
Control ctl = new Control();
int x = 1;
ctl = panel1.GetNextControl(this, true);
if (ctl is hsControlLibrary.UserControl1)
{
do
{
ctl.//Cannot access method in UserControl1 class
this.BindingContext[dataSet1, "Table1"].Position +=1;
}
while (panel1.Controls.Count >= x);
}
}
Thanks in advance!!!!
Re: Accessing methods in ControlLibrary
ctl.//Cannot access method in UserControl1 class
this.BindingContext[dataSet1, "Table1"].Position +=1;
Dont you need to cast the object to UserControl1 type?
e.g (UserControl1)ctl.youProperty