Is this now possible with vb.net? I know that before, the only way was to use global vars.
Sorry if the answer is extremely noticable when using .net. I haven't used much of it.
Thanks
Printable View
Is this now possible with vb.net? I know that before, the only way was to use global vars.
Sorry if the answer is extremely noticable when using .net. I haven't used much of it.
Thanks
You can create overloaded constructors for your form to take any additional paramters that you want to provide,
could you give me an example, if it's not too hard?
vars:
strName, arrCustomers
open up the "Windows Form Designer generated code" Region and put some parameters in the New procedure. then just pass whatever you want when you call the new method. Or if you want to be able to Send and recive variables use a procedure
Sometimes the IDE designer freaks out if there is no default constructor (one with no required parameters). So to get around this and make life easier just create a new constructor in the normal code where and make Me.New() the first thing it does. That will ensure that all of the controls and what not the you did at designtime still get created as normal.
VB Code:
'In normal code area 'local variable to hold the references Private _myParam As String=String.Empty Public Sub New(myParam As String) Me.New() 'set local to the one passed in Me._myParam=myParam End Sub 'Then you can create the form like this Dim f As New Form1("MyParamValue")