February 07, 2012   Login   |   Register  
  Search  
  |  
  Home | Blog

The Renegade Blog

Minimize
 Print   

The Renegade Blog

Minimize
 Print   

The Renegade Blog

Minimize
Feb 5

Written by: Renegade
Friday, February 05, 2010 12:14 PM

So, here we go:

   1:  private void button_Click(object sender, EventArgs e)
   2:  {
   3:      ((Button)sender).Enabled = false;
   4:      txtSomething.Text = System.Guid.NewGuid().ToString();
   5:      ((Button)sender).Enabled = true;
   6:  }

 Pretty easy, eh?

In the click event, the button is sent as the "sender". You must cast that as a Button, (Button)sender, then simply treat it like a button and access the Enabled property.

The second thing in there is getting a GUID string. Real easy. System.Guid.NewGuid().ToString(). Nothing hard there. Just remember not to use the "new" keyword.

I hope that helps somebody out.

Cheers,

Ryan

Copyright ©2010 Ryan Smyth

Tags:

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  
  

The Renegade Blog

Minimize
 Print   

Tweets

Minimize
 Print   
     
Renegade Minds About | Blog | Contact

  Search

Copyright 2010 by Renegade Minds   |   Privacy Statement   |   Terms of Use
Renegade Minds