Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 18th, 2003, 04:20 AM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Control and getting text form this

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

 
Old September 18th, 2003, 09:13 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form View in User Control shoakat ASP.NET 2.0 Professional 0 June 20th, 2007 07:29 AM
How to Link User control Form to Home page Dhanapal ASP.NET 1.0 and 1.1 Basics 1 March 12th, 2007 05:30 PM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
User Control Name in a Text Property laslanid Pro VB.NET 2002/2003 0 February 24th, 2005 04:31 AM
Display bar code in a Form using user input text? phoenixcu Access VBA 1 June 6th, 2003 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.