blah blah blah is here! blah blah » Close

up0down
link

Guys i may be way off the mark here, but is it possible to perform a different function buy clicking different datagridview cells? i have 2 columns in my datagridview that are buttons, i want to click column 1 cells and perform a function, then click column 2 cells and perform a different function, i've put a brief example below in the main click event just obviously it's just a point.

private void appsDataGridView_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
{
if (culumn 1 cell button clicked)
{
//do somethining here
}

if (column 2 cell clicked)
{
//do something here
}
}

last answered 2 years ago

1 answers

link

Try something like:

private void appsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
//do somethining here
}
else if (e.ColumnIndex == 1)
{
//do something here
}
}

That's perfect thanks vulpes - works a treat.

Feedback