|
-
May 12th, 2005, 04:33 AM
#1
Thread Starter
New Member
Pass values from Form to UserControl
Hello,
I m facing a problem in passing value from a Form to the UserControl. My project is a ActiveX Project that contains the following:
1. Form
2. UserControl
The UserControl contains a TextBox and a Command button. In clicking the command button, the Form appears.
The Form contains a ListBox and a command button. When the user selects an item from the list, and clicks the command button, the selected item should appear in the textbox of the UserControl.
I have tried creating an object of the UserControl in the Form but the failed to get any of the UserControls properties.
Please HELP!!1
-
May 12th, 2005, 05:06 AM
#2
Fanatic Member
Re: Pass values from Form to UserControl
You have to create the properties of the UserControl yourself. This code, for example, adds a Text property to the user control. When it's changed, the text in Text1 gets the new value. When it's retrieved, the property returns the text in Text1. 
VB Code:
Public Property Get Text() As String
Text = Text1.Text
End Property
Public Property Let Text(ByVal NewValue As String)
Text1.Text = NewValue
PropertyChanged Text
End Property
Author for Visual Basic Web Magazine
-
May 12th, 2005, 05:09 AM
#3
Fanatic Member
Re: Pass values from Form to UserControl
Oh, and I didn't even notice, but you posted this in the wrong section. The VB Codebank is meant to share completed snippets of code. To ask questions, post in Classic Visual Basic.
Author for Visual Basic Web Magazine
-
May 12th, 2005, 05:48 AM
#4
Re: Pass values from Form to UserControl
Welcome to the forums.
I have moved your thread from the CodeBank to the more appropriate COM/Active X forum section.
Thank you for your participation.
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
|