PC Review


Reply
Thread Tools Rate Thread

DataGrid Woes

 
 
John Smith
Guest
Posts: n/a
 
      10th Jan 2005
Hello all:

What is the best way to get a reference to an item selected in a data
grid? What I am trying to do is have it so a user can select from a
list in a data grid of all our employees and then click a button to
update that employees details. What is the best way to accomplish this
so that you can then bind this data to the next form?

Thanks,

- John -
 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      11th Jan 2005
Hello John,

You should utilize CurrencyManager to get the data record corresponding to
the current position in the DataGrid.

CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataGrid.DataSource,
dataGrid.DataMember];
DataRowView currentRow = (DataRowView)cm.Current;

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"John Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello all:
>
> What is the best way to get a reference to an item selected in a data
> grid? What I am trying to do is have it so a user can select from a list
> in a data grid of all our employees and then click a button to update that
> employees details. What is the best way to accomplish this so that you
> can then bind this data to the next form?
>
> Thanks,
>
> - John -


 
Reply With Quote
 
John Smith
Guest
Posts: n/a
 
      11th Jan 2005
Thanks for the reply, I will give it a try.
 
Reply With Quote
 
John Smith
Guest
Posts: n/a
 
      11th Jan 2005
What does it mean if I get the following errow upon executing the code:

Cannot create child list for TableName.

- John -
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP: ASP.NET & XML DataGrid.... woes :S dhruba.bandopadhyay Microsoft ASP .NET 0 30th Mar 2006 10:37 AM
datagrid woes Jesse Aufiero Microsoft VB .NET 3 13th Apr 2005 03:52 AM
DataGrid woes!!! Rookie Microsoft C# .NET 1 16th Jun 2004 08:16 PM
DataGrid Woes.. CJ Taylor Microsoft VB .NET 1 9th May 2004 07:26 AM
RE: More DataGrid Woes Josh Moody [MSFT] Microsoft VB .NET 0 29th Aug 2003 09:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 AM.