adding button columns to datagrids

  • Thread starter Thread starter Cyril Tiwari
  • Start date Start date
C

Cyril Tiwari

Could someone tell me how to add a button column to a datagrid, in a
Windows Form?

Here's where I'm at:

----------------------------------------------------------------------------
objOleDbDataAdapter = New OleDbDataAdapter("SELECT LNAME FROM
EMPLOYEE", objOleDbConnection)

objOleDbDataAdapter.Fill(objDataSet, "Employees")

DataGrid1.DataSource = objDataSet

DataGrid1.DataMember = "Employees"
-----------------------------------------------------------------------------

When I display the datagrid, I want 2 columns: 1 which lists the lname
of the employee, and another which consists of a button which allows
the user to go to a "details" page for that employee. I know this is
easy to do in a web app, but I can't figure out how to do this using
Windows Forms.

Any help would be greatly appreciated.
Thanks!
 
Hi Cyril,

You can add a button column in Design view. Select the datagrid, go
into the "Columns" propery in the properies window and add a "Button
Column".

take care,
Michelle
 
Hi Michelle,

Thanks for you reply. Are you sure this applies to datagrids withing a
Windows Form? I'm using VS.net 2003 and I don't see a "Columns"
property in the properties window.

Thanks,
Cyril
 
Sorry, I must have glazed over the bit where you wrote it was a
windows form. I took a look and, like you, I couldn't find an obvious
way to add a button column. I use a ListView in my applications for
what you need - so that a double click on the row or a button next to
the ListView will tigger the event to show the details of the item
selected.

sorry I wasn't more helpful

Michelle
 
Back
Top