Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to programming and need help. I m working with visual basic and win forms user controls.

I have one usercontrol that has the textbox where i would like to have a user type in the machine name of a computer they are trying to get data on. in this application i have 6 other user controls that will need the machine name from that one textbox. How do i declare that variable.

I can create the variable in the usercontrol and it works.

dim strcomputer as string
strcomputer = machinename.text

the textbox name is machinename. Thanks for the help ahead of time, and the more detailed the better so i can do this later on.
Posted
Comments
Manoj Kishor Bhoir 22-Nov-11 0:52am    
You are declaring your Variable as "Dim" thats why the Scope of Variable is Limitted only for your UserControl, you can't access it from another Class.For that you have to declare the Variable as "Public".

I am assuming that you want to put the contents of machinename.text into another textbox control?

If so then

anothertextboxName.text = machinename.text
 
Share this answer
 
Comments
Zachary.shupp 21-Nov-11 11:48am    
I dont want it to go to another text box i just want the coding to see it in other usercontrols if that makes any sense.
Simon_Whale 21-Nov-11 11:52am    
update your question with some more detail. i.e. what control you are trying to pass the machine name to etc.
Zachary.shupp 21-Nov-11 13:34pm    
the application i m working on is to pull wmi information on a remote computer. So the machine name text box is where i want the other user controls to get the name of the remote computer so when you click on the search button all 4 user controls pull the machien name so they can get the information they are supose to.
I'm not sure what you want to do, but i think you are talking about scoping of variables[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900