button - Declare Global Variable inside a Button1_Click -


i tried google abit could'nt find useful. in form1_load have variable

dim myvariable string 

then in button click want

myvariable = "hello" 

problem code tells me myvariable in button_click not declared is.

thanks help.

move variable field or property in form class. here example code:

public class form1     private myvariable      private sub form1_load(sender system.object, e system.eventargs) handles mybase.load         myvariable = "hello"     end sub      private sub button1_click(sender system.object, e system.eventargs) handles button1.click         messagebox.show(myvariable)     end sub end class 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -