Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,070 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,607 people online right now. Registration is fast and FREE... Join Now!




Help: pass events from datagridview to button

 
Reply to this topicStart new topic

Help: pass events from datagridview to button

glynn1280
9 Apr, 2008 - 03:02 PM
Post #1

New D.I.C Head
*

Joined: 9 Apr, 2008
Posts: 2

In my datagridview I have a customers table with a primary key 'customer_ID'. When a row is selected I need to pass that selected rows 'customer_ID' through the events into my delete button's method as an arg. Any help?

.NET v2 C# express 2005

User is offlineProfile CardPM
+Quote Post

Jayman
RE: Help: Pass Events From Datagridview To Button
9 Apr, 2008 - 04:42 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,919



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
You can use the SelectedRow property. Replace "CellName" with the name of the column that you want the data from.

CODE

string value = dataGridView.SelectedRows[0].Cells["CellName"].Value;

User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 07:08PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month