Click here to Skip to main content
16,004,901 members
Home / Discussions / C#
   

C#

 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Kataric14-May-07 12:26
Kataric14-May-07 12:26 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Christian Graus14-May-07 12:53
protectorChristian Graus14-May-07 12:53 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Kataric14-May-07 13:08
Kataric14-May-07 13:08 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Christian Graus14-May-07 13:40
protectorChristian Graus14-May-07 13:40 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Luc Pattyn14-May-07 13:40
sitebuilderLuc Pattyn14-May-07 13:40 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Kataric14-May-07 13:40
Kataric14-May-07 13:40 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Kataric14-May-07 13:42
Kataric14-May-07 13:42 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Kataric14-May-07 14:22
Kataric14-May-07 14:22 
Ok, now this is a interesting problem.

I put in this code in my Event Handler Function LeftClickButton()

private void LeftClickButton(object sender, EventArgs e)<br />
      {<br />
          Button temp = sender as Button;<br />
          string str;<br />
          str = temp.Name;<br />
          int x = int.Parse("0" + temp.Name);<br />
          int y = Convert.ToInt32(temp.Name);<br />
          this.button[x].BackColor = System.Drawing.Color.Red;<br />
      }


and whenever I click on a button, the background doesn't change, and I get an exception unhandled error (which i can continue through if possible).

The code fails on the int x = int.Parse("0" + temp.Name); and int y = Convert.ToInt32(temp.Name); both. It's like the convert or the int.Parse arn't converting the temp.name into a integer readable by the dictionary template index. Any advice on this would be appreciated.
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Martin#14-May-07 20:02
Martin#14-May-07 20:02 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Kataric14-May-07 20:19
Kataric14-May-07 20:19 
GeneralRe: Declaring 9x9 buttons using dictionary type Pin
Martin#14-May-07 20:24
Martin#14-May-07 20:24 
Questioncannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 11:17
Latheesan14-May-07 11:17 
AnswerRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Colin Angus Mackay14-May-07 11:24
Colin Angus Mackay14-May-07 11:24 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 11:37
Latheesan14-May-07 11:37 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Colin Angus Mackay14-May-07 11:42
Colin Angus Mackay14-May-07 11:42 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 11:51
Latheesan14-May-07 11:51 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Colin Angus Mackay14-May-07 11:57
Colin Angus Mackay14-May-07 11:57 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 12:05
Latheesan14-May-07 12:05 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 12:09
Latheesan14-May-07 12:09 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Colin Angus Mackay14-May-07 12:11
Colin Angus Mackay14-May-07 12:11 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 12:45
Latheesan14-May-07 12:45 
AnswerRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Christian Graus14-May-07 11:36
protectorChristian Graus14-May-07 11:36 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Latheesan14-May-07 11:52
Latheesan14-May-07 11:52 
GeneralRe: cannot convert from 'string' to 'AccountManagement.IAccount' Pin
Christian Graus14-May-07 12:28
protectorChristian Graus14-May-07 12:28 
QuestionOutlook dev question Pin
szukuro14-May-07 10:27
szukuro14-May-07 10:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.