Link to home
Start Free TrialLog in
Avatar of TrackerGroup
TrackerGroup

asked on

Transfer data from a user control textbox to textbox on a form - c#

I have a user control I made on a windows form.  When the control is activated the user there are several texboxes on it containing int32 values based on user input in/on the control.  I would like to have these values transfer to textboxes on the windows form, so the data from the control is included in the dataset update to the database.
ASKER CERTIFIED SOLUTION
Avatar of p_davis
p_davis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of p_davis
p_davis

you can databind as well

formTextBox.DataBindings.Add("Text", tb ,"Text");
TrackerGroup,

You might want to post some of the code.  But, off the top of my head, here are some things that I could point out:

1. "there are several texboxes [sic] on it containing int32 values"
Textboxes don't contain int32 datatypes.  The x.Text property of the textbox contains a String.

2. To make the text in one textbox populate into another textbox, it should be relatively easy:
TextBoxB.Text = TextBoxA.Text

3. Keep in mind that the update to the database is not necessarily impacted by whether or not you've put values into textboxes.  You could always simply take the values straight from the control and update the database:

Dim TextString as String
Dim TextInt as Integer

TextString = TextBoxA.Text
TextInt = Convert.ToInt32(TextString)

<Code to Connect to Database>
<Code to Update Database>

Does that help at all?

<-=+=->
Avatar of TrackerGroup

ASKER

You are awesome!!  Thank you so very much for your quick response!!  It works perfectly.
It took me longer researching this on my own than asking an expert.  I should have asked the experts first.  Thanks Experts-exchange.
thanks for the compliment, i am glad it worked for you.