Click here to Skip to main content
15,909,051 members
Home / Discussions / C#
   

C#

 
QuestionHow to use a GridView in a ListView - C# WinForms Pin
ramz_g13-May-09 18:35
ramz_g13-May-09 18:35 
AnswerRe: How to use a GridView in a ListView - C# WinForms Pin
Dave Kreskowiak13-May-09 19:21
mveDave Kreskowiak13-May-09 19:21 
GeneralRe: How to use a GridView in a ListView - C# WinForms Pin
ramz_g13-May-09 22:58
ramz_g13-May-09 22:58 
GeneralRe: How to use a GridView in a ListView - C# WinForms Pin
Henry Minute13-May-09 23:55
Henry Minute13-May-09 23:55 
GeneralRe: How to use a GridView in a ListView - C# WinForms Pin
ramz_g14-May-09 0:15
ramz_g14-May-09 0:15 
QuestionPlaying flv files [modified] Pin
Evgeni5713-May-09 18:26
Evgeni5713-May-09 18:26 
AnswerRe: Playing flv files Pin
Dave Kreskowiak13-May-09 19:16
mveDave Kreskowiak13-May-09 19:16 
GeneralRe: Playing flv files Pin
Evgeni5713-May-09 21:58
Evgeni5713-May-09 21:58 
Questionrestore database at an other server Pin
adsana13-May-09 17:57
adsana13-May-09 17:57 
AnswerRe: restore database at an other server Pin
Mycroft Holmes13-May-09 18:05
professionalMycroft Holmes13-May-09 18:05 
AnswerRe: restore database at an other server Pin
Rhys Jacob13-May-09 22:23
Rhys Jacob13-May-09 22:23 
QuestionHow to modify the foreach identifier? Pin
blackhattrick13-May-09 17:02
blackhattrick13-May-09 17:02 
AnswerRe: How to modify the foreach identifier? PinPopular
Luc Pattyn13-May-09 17:28
sitebuilderLuc Pattyn13-May-09 17:28 
JokeRe: How to modify the foreach identifier? Pin
Samer Aburabie13-May-09 20:22
Samer Aburabie13-May-09 20:22 
QuestionDynamically adding a action to a datagrid Pin
Brad Wick13-May-09 13:29
Brad Wick13-May-09 13:29 
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 

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.