Click here to Skip to main content
15,919,245 members
Home / Discussions / C#
   

C#

 
GeneralRe: Avoiding memory leaks Pin
riced31-Jan-09 5:13
riced31-Jan-09 5:13 
AnswerRe: Avoiding memory leaks Pin
Christian Graus30-Jan-09 15:39
protectorChristian Graus30-Jan-09 15:39 
AnswerRe: Avoiding memory leaks Pin
Najmal31-Jan-09 4:08
Najmal31-Jan-09 4:08 
Questioncan windows form controls as buttons and progress bars be skinned..... Pin
Mubeen.asim30-Jan-09 10:19
Mubeen.asim30-Jan-09 10:19 
AnswerRe: can windows form controls as buttons and progress bars be skinned..... Pin
Eddy Vluggen30-Jan-09 10:58
professionalEddy Vluggen30-Jan-09 10:58 
GeneralRe: can windows form controls as buttons and progress bars be skinned..... Pin
PIEBALDconsult30-Jan-09 10:59
mvePIEBALDconsult30-Jan-09 10:59 
GeneralRe: can windows form controls as buttons and progress bars be skinned..... Pin
Eddy Vluggen30-Jan-09 11:02
professionalEddy Vluggen30-Jan-09 11:02 
GeneralDataGridViewButton click event Pin
leeoze30-Jan-09 9:54
leeoze30-Jan-09 9:54 
I was searching thru the web and couldn't realy find a conclusive explanation on how to attach an event to DataGridViewButton.

Since I found the answer to my question I have decided to share it with others...

You can not attach an event to a specific DataGridViewButton. The only way to by pass this block is to use the CellClick event of the DataGridView control. By doing so, keep in mind that this event is automaticly attached to any button on the DataGridView. In order to use this event for a specific button on the row, you will need to check if the object which fired the event has the name of your desired button. Take a look at the example:

if (MyGridView.Rows[e.RowIndex].Cell[e.ColumnIndex].Name == "MyButtonName")
{
    //do what ever
}


Also, if you notice, when you click on any row on the first cloumn (the blank one that cause a full row selection) it fires the same event. The problem is that it sends a column index of -1 which can not retrive a coulmn name. This cause an expectaion error. In order to fix it use this example:

if (
e.ColumnIndex != -1 &&
MyGridView.Rows[e.RowIndex].Cell[e.ColumnIndex].Name == "MyButtonName")
{
    //do what ever
}


Make sure the first condition is the "e.ColumnIndex != -1".

Hope I could help anyone with this information.
QuestionAllowing Chinese Text in Visual Studio 05 Pin
Cozmo2330-Jan-09 7:15
Cozmo2330-Jan-09 7:15 
QuestionConnection to contactless card reader Pin
Hristiyan30-Jan-09 5:43
Hristiyan30-Jan-09 5:43 
AnswerRe: Connection to contactless card reader Pin
musefan30-Jan-09 6:07
musefan30-Jan-09 6:07 
GeneralRe: Connection to contactless card reader Pin
Hristiyan1-Feb-09 21:37
Hristiyan1-Feb-09 21:37 
Questionmodify type of dataset column Pin
pippyn30-Jan-09 4:24
pippyn30-Jan-09 4:24 
AnswerRe: modify type of dataset column Pin
howlettt30-Jan-09 4:38
howlettt30-Jan-09 4:38 
GeneralRe: modify type of dataset column Pin
pippyn30-Jan-09 5:06
pippyn30-Jan-09 5:06 
GeneralRe: modify type of dataset column Pin
howlettt30-Jan-09 6:03
howlettt30-Jan-09 6:03 
GeneralRe: modify type of dataset column Pin
pippyn30-Jan-09 6:22
pippyn30-Jan-09 6:22 
QuestionPrint the columns of a DataGrid in individual blocks Pin
pavanip30-Jan-09 4:00
pavanip30-Jan-09 4:00 
AnswerRe: Print the columns of a DataGrid in individual blocks Pin
leeoze30-Jan-09 10:04
leeoze30-Jan-09 10:04 
GeneralRe: Print the columns of a DataGrid in individual blocks Pin
pavanip30-Jan-09 19:40
pavanip30-Jan-09 19:40 
AnswerRe: Print the columns of a DataGrid in individual blocks Pin
leeoze30-Jan-09 23:50
leeoze30-Jan-09 23:50 
AnswerRe: Print the columns of a DataGrid in individual blocks Pin
Najmal31-Jan-09 4:13
Najmal31-Jan-09 4:13 
Questiongetting the tip message for method during design time Pin
Blubbo30-Jan-09 3:33
Blubbo30-Jan-09 3:33 
AnswerRe: getting the tip message for method during design time Pin
musefan30-Jan-09 3:38
musefan30-Jan-09 3:38 
GeneralRe: getting the tip message for method during design time Pin
Blubbo30-Jan-09 3:45
Blubbo30-Jan-09 3:45 

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.