473,698 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid Woes

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 -
Nov 16 '05 #1
3 1078
Hello John,

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

CurrencyManager cm =
(CurrencyManage r)this.BindingC ontext[dataGrid.DataSo urce,
dataGrid.DataMe mber];
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" <oh******@hotma il.com> wrote in message
news:eF******** *****@TK2MSFTNG P15.phx.gbl...
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 -


Nov 16 '05 #2
Thanks for the reply, I will give it a try.
Nov 16 '05 #3
What does it mean if I get the following errow upon executing the code:

Cannot create child list for TableName.

- John -
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1717
by: Mark | last post by:
O, woe is me, to have seen what I have seen, see what I see! (That's Shakespeare for those who were wondering what I'm on about) I am "having fun" with cookies. And I wonder if I have missed something obvious.
0
1525
by: Cedric | last post by:
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive (someone@microsoft.com) Subject: Upgrade woes: Numeric, gnuplot, and Python 2.4 Date: 2004-12-11 18:45:10 PST > Here's my sitch: > > I use gnuplot.py at work, platform Win32. > I want to upgrade to Python 2.4.
3
3452
by: Angel Cat | last post by:
Trying to get my jobs to send mail when job fails. Should be easy but it's giving me headache Had a whole slew of issues. Outlook is installed with a n outlook mail profile set up that can send mail in outlook. I can create a SendMail DTS and execute it to send mail Email works in these scenarios 1. I create a DTS package in SQL Server with just SendMail with the same Profile "ABC" and click Execute and it sends
2
1830
by: Andrew Thompson | last post by:
- NN 4.78 rendering woes, links at far left - I am trying to rework an old site, make it valid html and css, improving the x-browser and 'older browser' compatibility. My efforts so far, have been abysmal. See, for example, this screen shot of the very simple home page, it is not even 10% finished, but I have already run into problems. http://www.physci.org/test/xbrowser/nn478home01.png
0
1034
by: Paul Sampson | last post by:
Hi, I have a typed dataset working nicely, bound to my datagrid (Windows forms) using stored procs for insert/update/delete. The first column contains the primary key of the base table, so when I add a new record it inserts into the dbase fine. However the PK column still shows (null), meaning it hasn't refreshed back from the database. What's the best way to get back the PK and insert it into my Dataset and grid?
0
1102
by: John Hopper | last post by:
Can someone please tell me why the datagrid doesn't databind and display rows once the Add button is clicked and the cmdSaveToDataset event fires, to add a row to the dataset? I've copied the code: ------------------- Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code "
1
1039
by: CJ Taylor | last post by:
Alright, so this is strange. someone let me know if this is a *bug* or not. Whenever I would use Dataset.Merge(datarows()) method, I would always get an exception (IndexOutOfRangeException) on the currency manager after a paint was fired on the datagrid controls. Old code was currMan.Suspendbinding()
0
948
by: Dhruba Bandopadhyay | last post by:
I need advise on ASP.NET & XML. I got a Web Service that I call in real-time to generate a XML document (in main memory, not file). I could use the .NET built-in XML document generation classes, but Web Service does the same I guess. 1. Is it possible to feed this XML document object into a DataGrid/View/List without saving the XML object to file? I seen examples where they load the XML document from file. I don't want to do this as I...
1
2271
by: barbara_dave | last post by:
Hi All, I'd like to add numericUpDown controls in every cell of a column of a datagrid. Is there some sample code I can get for reference? Thanks In Advance!
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.