|
Subject:
|
User Control and getting text form this
|
|
Posted By:
|
SuperHp
|
Post Date:
|
9/18/2003 4:20:59 AM
|
I am creating a user control which should be managed from a webform.
I have a user control with a textbox
On my webform I have created 4 instances of the user control.
I've also added 4 labels and a button. What I wish to do is to multiplicate the entered value from the user control by 5 and then show the result in a label. How could this be done?
I am using VB.Net
|
|
Reply By:
|
planoie
|
Reply Date:
|
9/18/2003 9:13:57 AM
|
So your buttons and labels are on the webform and not on the usercontrol itself?
You need to publicly expose the text value of the user control's textbox. My recommendation is to create a public property on the user control that exposes it.
Public ReadOnly Property TextValue() As String Get Return myTextBox.Text End Get End Property
Now, on your webform you can access the values like this...
Label1.Text = CType(textBoxUserControl1.TextValue, Integer) * 5 Label2.Text = CType(textBoxUserControl2.TextValue, Integer) * 5 etc.
(I assume you meant "multiply" right?)
Peter
|