Board index » Visual Studio » How to pass parameter between vb.net forms

How to pass parameter between vb.net forms

Visual Studio229
Hi



Can anyone help me with my problem. I've created 2 forms. Each has a local

variable. How can I pass the st2 string in form2 to st1 in form1.



Example

form1:

dim str1 as string



form2:

dim st2 as string





Please help. Thanks



Regards

Melson


-
 

Re:How to pass parameter between vb.net forms

I'm not sure... do these forms have a parent form?

Does one launch the other?



Obviously you could have a



ReadOnly Public Property String1 as string

Get

.

.

end property



on the form, or a public method on one or both forms, or pass a callback

function to one of the forms. Depends on what you are trying to do and the

main thought for me, is how does one form know the other exists? Are they

part of an MDI app?



More info is needed before an intellegent answer could be given.



Thanks,



Shane



"Melson" <wee789@hotmail.com>wrote in message

Quote
Hi



Can anyone help me with my problem. I've created 2 forms. Each has a local

variable. How can I pass the st2 string in form2 to st1 in form1.



Example

form1:

dim str1 as string



form2:

dim st2 as string





Please help. Thanks



Regards

Melson









-

Re:How to pass parameter between vb.net forms

Melson,



Absolute in the top 10 of the most asked questions in this newsgroup



Maybe does one of these answers fits you



http://groups-beta.google.com/group/microsoft.public.dotnet.languages.vb/search?hl" rel="nofollow" target="_blank">groups-beta.google.com/group/microsoft.public.dotnet.languages.vb/search=en&group=microsoft.public.dotnet.languages.vb&q=pass+forms&qt_g=1&searchnow=Search+this+group



I hope this helps,



Cor





-

Re:How to pass parameter between vb.net forms

Declare it as Shared.



Public Shared st2 as string



str1 = form2.st2



Or create a module and declare str1 and st2 in the module, then access from

either form.



"Melson" <wee789@hotmail.com>wrote in message

Quote
Hi



Can anyone help me with my problem. I've created 2 forms. Each has a local

variable. How can I pass the st2 string in form2 to st1 in form1.



Example

form1:

dim str1 as string



form2:

dim st2 as string





Please help. Thanks



Regards

Melson









-