Retrieving a value from another form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello. I am using vb.net.

There are two forms in my program, 'base' and 'editor'.
In the form 'base', there is a string varible called 'user'.
How can I copy this piece of information to the form 'editor'?
Thanks.
 
'declare your string variable user in for "base"
Public userName As String


'in the code behind for form 'Base" and before launching "Editor" form

Dim frmEditor1 As New frmEditor

frmEditor1.userName = userName

frmEditor1.ShowDialog()

Note that you have to define the variable username as public in the "editor"
form too.

I hope this will give you a hint. There are other ways of doing it too, but
I believe this serves the purpose too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top