Click here to Skip to main content
15,887,988 members
Home / Discussions / C#
   

C#

 
AnswerRe: Dynamically adding a action to a datagrid Pin
Mycroft Holmes13-May-09 14:30
professionalMycroft Holmes13-May-09 14:30 
AnswerRe: Dynamically adding a action to a datagrid Pin
Henry Minute13-May-09 14:38
Henry Minute13-May-09 14:38 
GeneralRe: Dynamically adding a action to a datagrid Pin
Mycroft Holmes13-May-09 18:07
professionalMycroft Holmes13-May-09 18:07 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute13-May-09 23:18
Henry Minute13-May-09 23:18 
GeneralRe: Dynamically adding a action to a datagrid Pin
Mycroft Holmes13-May-09 23:23
professionalMycroft Holmes13-May-09 23:23 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute14-May-09 0:04
Henry Minute14-May-09 0:04 
GeneralRe: Dynamically adding a action to a datagrid Pin
Brad Wick14-May-09 4:58
Brad Wick14-May-09 4:58 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute14-May-09 11:13
Henry Minute14-May-09 11:13 
OK.

This line:
dataGridTicketInformation.DoubleClick += new System.EventHandler(dataGridTicketInformation, new CustomRowEventArgs(dataGridTicketInformation));


should be:
dataGridTicketInformation.DoubleClick += new System.EventHandler(dataGridTicketInformation);

***** See below for where to put it


and it is not used to call the doubleclick function it is used to link each DataGridView with the dataGridTicketInformation_DoubleClick method you have written, so that when you doubleclick on any of your grids you will get your "DoubleClick Sent" messageBox. It should be part of the creation of each DataGridView the line should go
DataGridView dataGridTicketInformation = new System.Windows.Forms.DataGridView();
dataGridTicketInformation.Name = "dataGridView" + tabIndex.ToString();
dataGridTicketInformation.Size = new System.Drawing.Size(401, 201);

// First we need to add a column
dataGridTicketInformation.Columns.Clear();
dataGridTicketInformation.Columns.Add("Name", "Name");
dataGridTicketInformation.Columns[0].Width = 301;

dataGridTicketInformation.Columns.Add("Data", "Data");
dataGridTicketInformation.Columns[1].Width = 100;

// Clear all the old Data first
dataGridTicketInformation.Rows.Clear();

// ***************************************
//              HERE (ish)
// ***************************************
dataGridTicketInformation.DoubleClick += new System.EventHandler(dataGridTicketInformation);


Unless there is a need to pass some special data on double click the CustomRowEventArgs is not needed. Even if this need exists, I would concentrate on getting the plain old doubleclick functionality working first, so that you can get an understanding of how it works.
Make a separate post if you need help in implementing a CustomRowEventArgs.

Assuming that you do this, all that needs to happen for the doubleclick action to be triggered is for you to double-click any of the dataGridTicketInformation instances that your app creates at run-time.

When you get it working with your messageBox version of dataGridTicketInformation_DoubleClick, it is important that you use the
DataGridView dgv = (DataGridView)sender;


method I showed earlier, otherwise you will not be able to tell which dataGridTicketInformation made the call.

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: Dynamically adding a action to a datagrid Pin
Brad Wick14-May-09 13:00
Brad Wick14-May-09 13:00 
GeneralRe: Dynamically adding a action to a datagrid Pin
Henry Minute14-May-09 13:13
Henry Minute14-May-09 13:13 
QuestionC# & Core 2 due CPUs Pin
Mohammad Dayyan13-May-09 12:30
Mohammad Dayyan13-May-09 12:30 
AnswerRe: C# & Core 2 due CPUs Pin
Luc Pattyn13-May-09 12:46
sitebuilderLuc Pattyn13-May-09 12:46 
AnswerRe: C# & Core 2 due CPUs Pin
Joe Woodbury13-May-09 15:38
professionalJoe Woodbury13-May-09 15:38 
Questionhow to add numbers to form with specified position Pin
Aljaz11113-May-09 12:27
Aljaz11113-May-09 12:27 
AnswerRe: how to add numbers to form with specified position Pin
Tony Richards13-May-09 12:43
Tony Richards13-May-09 12:43 
GeneralRe: how to add numbers to form with specified position Pin
Aljaz11113-May-09 12:46
Aljaz11113-May-09 12:46 
GeneralRe: how to add numbers to form with specified position Pin
Luc Pattyn13-May-09 13:20
sitebuilderLuc Pattyn13-May-09 13:20 
AnswerRe: how to add numbers to form with specified position Pin
Henry Minute13-May-09 14:42
Henry Minute13-May-09 14:42 
QuestionHow to stop an Event Pin
Payam Rastogi13-May-09 10:11
Payam Rastogi13-May-09 10:11 
AnswerRe: How to stop an Event Pin
Dave Kreskowiak13-May-09 10:47
mveDave Kreskowiak13-May-09 10:47 
GeneralRe: How to stop an Event Pin
PIEBALDconsult13-May-09 14:59
mvePIEBALDconsult13-May-09 14:59 
GeneralRe: How to stop an Event Pin
Luc Pattyn13-May-09 15:39
sitebuilderLuc Pattyn13-May-09 15:39 
GeneralRe: How to stop an Event Pin
Dave Kreskowiak13-May-09 19:12
mveDave Kreskowiak13-May-09 19:12 
GeneralRe: How to stop an Event Pin
Payam Rastogi14-May-09 11:05
Payam Rastogi14-May-09 11:05 
GeneralRe: How to stop an Event Pin
Dave Kreskowiak14-May-09 17:54
mveDave Kreskowiak14-May-09 17:54 

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.