By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,375 Members | 1,378 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,375 IT Pros & Developers. It's quick & easy.

adding button columns to datagrids

P: n/a
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!
Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

Nov 22 '05 #2

P: n/a
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
"Michelle" <Mi******@bwalk.com> wrote in message news:<11**********************@g14g2000cwa.googleg roups.com>...
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

Nov 22 '05 #3

P: n/a
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

Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.