Visual Basic .NET » Windows Forms
Passing variables between forms in different projects -- "ummm..." --



rich wrote:
I have two projects within an Enterprise Project in VS'03

I need to pass a variable 'x' from Form1 in ProjectA to Form2 to
ProjectB. Any ideas?

I tried a public variable in a Module file, but of course that only
works within that project. I'm UI designer, not a programmer, so I'm
sure there are simple solutions I've over looked. Any help would be
greatly appreciated.

Thanks.

 

-- "ummm..." --


Assuming that Project A has a reference to Project B then surely all you need to do is create a shared or non shared public property inside the form2 class

Private m_aPropertyInForm2 as boolean
Public Property aPropertyInForm2() As Boolean
Get
Return m_aPropertyInForm2

End Get
Set(ByVal Value As Boolean)
m_aPropertyInForm2 = value
End Set
End Property

If form1 has an object reference for form2 called myForm2Reference then you can set the property by doing myForm2Reference.aPropertyInForm2 = true

-- navdeeps --


in your same module where you are using "public variables" use "public shared variable_name". it will work across the application.
rich wrote:
I have two projects within an Enterprise Project in VS'03

I need to pass a variable 'x' from Form1 in ProjectA to Form2 to
ProjectB. Any ideas?

I tried a public variable in a Module file, but of course that only
works within that project. I'm UI designer, not a programmer, so I'm
sure there are simple solutions I've over looked. Any help would be
greatly appreciated.

Thanks.

 

-- Vasu --


But navdeep u see it is not working.
shared variables cannot be declared in modules. check for it.

-- Mehul Patel --

Good Morning

If have a both project in single solution then declare a your variable as a public and access it using

projectA.xyz if xyz variable declare in projectA

Try this.
And reply me.

Have a Nice Day

[Submit Comment]Home