WinForms Parameters

  • Thread starter Thread starter Viswanathan S
  • Start date Start date
V

Viswanathan S

Hi All,

How to pass parameter to winform. From a menu there are several items. When
click on any item a form will be open. For opening a form i am giving some
parameters to the form.

When i use global variables, the value changed when a new form is opened. Is
there any other way to pass window parameters?


Thanks in Advance
S. Viswanathan
 
How do you want to pass them?

Do you want to transfer text for example from a parameter declared in form 1
to a textbox/label on form 2?

Microsoft doesn't recomment using global variables, which is in contrast to
the old VB 6 where they did tell people to use it.

Answer my two initial questions & I or anyone else will do our best to help
you

Crouchie1998
BA (HONS) MCP MCSE
 
Viswanathan,

A form is a class, you can pass in the normal way that you pass information
to the instanced object to do that.

One is because you have in your form class created a sub new and than you
can do
Something as
Public sub New(byval myparama as integer, byval myparamb as integer)
myPrivateValueA = myparma
myPrivateValueB = myparmb
End sub
And than you do

Dim MyForm = MyFormClass(myparameterx, myparametery)

Or you have public properties in your form and than you can before you do
the show set those as
MyForm.myPublicPropertyA = myparama
MyForm.publicPropertyB = myparamb

I hope this helps,

Cor
 
Viswanathan S said:
How to pass parameter to winform. From a menu there are several items.
When click on any item a form will be open. For opening a form i am
giving some parameters to the form.

When i use global variables, the value changed when a new form is
opened. Is there any other way to pass window parameters?

http://www.codeproject.com/dotnet/WorkingWithWinForms.asp


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
 

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