vb.net - Make parameters that get from function to be able for accessing from others sub -
vb.net - Make parameters that get from function to be able for accessing from others sub -
i want access parameters sent function in class without declare variable above class represent meant this
public sub initializeform(byval title string, doccode string, billno string) me.text = title me.txtdoccode.text = doccode me.txtbillno.text = billno end sub and want access variable named "docccode" sub in same class
private sub savedata //i want access doccode here without declare variable define end sub
all need declare either global variable or property hold value. however, since setting value textbox, assuming value won't change, can read value straight textbox, below;
private sub savedata dim x string = txtdoccode.text end sub otherwise, if value might subject change, , wish preserve initial value, can proceed below;
public class myclass ' global variable hold value private doc string public sub initializeform(byval title string, doccode string, billno string) doc = doccode me.text = title me.txtdoccode.text = doccode me.txtbillno.text = billno end sub private sub savedata ' doc variable still available end sub end class vb.net visual-studio-2013 c#-to-vb.net
Comments
Post a Comment