A1VBCode Forums

passing variable to a button


http://www.a1vbcode.com/vbforums/Topic30049.aspx

By john_zakaria - 2/13/2011

hi everyone.. i am using windows application to get data from web service and according to the result an action will be taken



for example if the result is 1 i will download a file and the name of the file will be taken from my database.



all that i need is to pass the name of the file from the form to the button_click Event



my result is:





private void button1_Click(object sender, EventArgs e)

{





WebClient webClient = new WebClient();

webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);

webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);

webClient.DownloadFileAsync(new Uri("http://www.myexample.com/john_test/Setup.msi"), @"c:\Setup.msi");



}











i want it to be













private void button1_Click(object sender, EventArgs e)

{





WebClient webClient = new WebClient();

webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);

webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);

webClient.DownloadFileAsync(new Uri("http://www.myexample.com/john_test/"+Result), @"c:\"+Result);



}





i want to pass variable to the button or use something like Global variable but i dont know how to use its syntax?

can anyone help me please