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.
TrackerGroupAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

p_davisCommented:
TextBox tb = userControl.Controls["controlName"] as TextBox;
formTextBox.Text = tb.Text;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
p_davisCommented:
you can databind as well

formTextBox.DataBindings.Add("Text", tb ,"Text");
0
Joseph HornseyPresident and JanitorCommented:
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?

<-=+=->
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

TrackerGroupAuthor Commented:
You are awesome!!  Thank you so very much for your quick response!!  It works perfectly.
0
TrackerGroupAuthor Commented:
It took me longer researching this on my own than asking an expert.  I should have asked the experts first.  Thanks Experts-exchange.
0
p_davisCommented:
thanks for the compliment, i am glad it worked for you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.