There are many ways of doing something like that, and to be honest i am not sure what the 'correct' way is, so i will give you a few ideas below and you can choose the one which best suits your needs
1 - Set the label on the form2
Dim objNewForm as new Form2
objNewForm.label1.text = strPersonName
objNewForm.show
2 - Set a property on the new form so you can use it
Dim objNewFOrm as new Form2
objNewForm.PersonName = strPersonName
objNewForm.show
and remember to create a public property on the form
3 - Set the parent of Form2 to Form1
Dim objNewForm as new Form2
objNewFOrm.parent = me
objNewForm.show
Then on the form you can
Dim objParent as Form1 = me.parent
label1.text = me.parent.textbox1.text
There are other ways, if none of theese meet your needs let me know and i will throw a few more your way
thanks mate, but can you throw some more ideas. i will give u the low down on what im trying to do , when a user logs in successfully into the application i want their username by which they loged in with to appear on the main form.
Then when the user logs in save their ID in the USER string. (by the way it should be possible to determine the USERID that they signed ontot he machine with from the system if you prefer that method).
Then in the Form1_Load event set the Text of where you want the USERID to be USER.
thanks kevin, i actually wrote some code similar to what u mentioned above, but i was going wrong somewhere, after reading your thread I relised i had to declare the string public, silly of me.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.