|
-
Sep 2nd, 2004, 08:43 AM
#1
Thread Starter
Lively Member
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!!!!
-
Sep 2nd, 2004, 08:47 AM
#2
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
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Sep 2nd, 2004, 09:01 AM
#3
Thread Starter
Lively Member
It still won't let me access any class methods at design time.
If I drop a UserControl1 on my form and reference to it, it works!! But I need to create these at runtime.
The intellisense only gives me the following:
hsControlLibrary.UserControl1.ControlAccessibleObject and .ControlCollection. No user defined methods!!!
But if I drop a UserControl1 on my form then go..
this.myUC.BindControls(...); //I get my method!!!
????
-
Sep 2nd, 2004, 01:13 PM
#4
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|