473,713 Members | 3,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with DataGrid

I have a DataGrid on Form1 that displays a small amount of information about
employees.
On Form2 I want to have all the data displaying in text boxes about the
employee selected in the datagrid on form 1.
Is there a Id in the datagrid I can use to find out which user was selected
or which record was highlighted when double clicked.
Something like: John Thomas Employee Id 2637 was selected on Form1 and the
recordset on Form2 would use that Id as a variable in the recordset.

I know ASP quite well but I don't know how to do this in Windows Forms.

Thank you

ER*******@pacif icdesignstudios .com
Nov 19 '05 #1
4 2208
Pacific,

Welcome to the DGS club. (Data grids suck)
A datagrid does not have the same rich set of events that other controls
have. They also do not allow for the simplest tasks unless you buy third
party DataGrid columns such as DropDown boxes and such. In windows you have
the DataGridTextCol umn and the DataGridBoolCol umn. Thats it. A DataGrid can
not even tel when the text value of a cell has changed.
I did something like what you propose by doing the following.
1. I keep a dataset in memory representing the original values of the
datagrid in order to know when the value has changed.
2. You will want to keep two or more values in memory so you can keep track
of where you are and where you were. This way you can validate the values of
where you were when you discover that the user has moved to another column.
3. You will also want to capture the left arrow keydown event and suppress
it when the user was on the first column. There is nothing worse to a user
than having the DataGrid reposition on the last column of the previous row
when the left arrow is pressed. The user gets completely lost!

Only by keeping careful control of the users keystrokes can you even begin
to think of syncing up with another form.

It sounds like you are just using the DataGrid to select the name of the
employee. Have you considered using a ListBox or ComboBox control for that.
You can use a monotype font (to line up columns) and simulate a chart on a
ComboBox.
"Pacific Design Studios" <ER*******@paci ficdesignstudio s.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I have a DataGrid on Form1 that displays a small amount of information about employees.
On Form2 I want to have all the data displaying in text boxes about the
employee selected in the datagrid on form 1.
Is there a Id in the datagrid I can use to find out which user was selected or which record was highlighted when double clicked.
Something like: John Thomas Employee Id 2637 was selected on Form1 and the recordset on Form2 would use that Id as a variable in the recordset.

I know ASP quite well but I don't know how to do this in Windows Forms.

Thank you

ER*******@pacif icdesignstudios .com

Nov 19 '05 #2
By the way a good font to use on ComboBoxes would be "Lucida Console" It's
fairly standard for Windows and would allow you to line up your columns in
the text.

"Jerry" <Je*********@ya hoo.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.phx.gbl...
Pacific,

Welcome to the DGS club. (Data grids suck)
A datagrid does not have the same rich set of events that other controls
have. They also do not allow for the simplest tasks unless you buy third
party DataGrid columns such as DropDown boxes and such. In windows you have the DataGridTextCol umn and the DataGridBoolCol umn. Thats it. A DataGrid can not even tel when the text value of a cell has changed.
I did something like what you propose by doing the following.
1. I keep a dataset in memory representing the original values of the
datagrid in order to know when the value has changed.
2. You will want to keep two or more values in memory so you can keep track of where you are and where you were. This way you can validate the values of where you were when you discover that the user has moved to another column. 3. You will also want to capture the left arrow keydown event and suppress
it when the user was on the first column. There is nothing worse to a user than having the DataGrid reposition on the last column of the previous row
when the left arrow is pressed. The user gets completely lost!

Only by keeping careful control of the users keystrokes can you even begin
to think of syncing up with another form.

It sounds like you are just using the DataGrid to select the name of the
employee. Have you considered using a ListBox or ComboBox control for that. You can use a monotype font (to line up columns) and simulate a chart on a
ComboBox.
"Pacific Design Studios" <ER*******@paci ficdesignstudio s.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I have a DataGrid on Form1 that displays a small amount of information

about
employees.
On Form2 I want to have all the data displaying in text boxes about the
employee selected in the datagrid on form 1.
Is there a Id in the datagrid I can use to find out which user was

selected
or which record was highlighted when double clicked.
Something like: John Thomas Employee Id 2637 was selected on Form1 and

the
recordset on Form2 would use that Id as a variable in the recordset.

I know ASP quite well but I don't know how to do this in Windows Forms.

Thank you

ER*******@pacif icdesignstudios .com


Nov 19 '05 #3
Cor
The listview is much nicer for this problem
Nov 19 '05 #4
I will say one thing... Datagrids are great in ASP.NET, but the only reason
one should do it in Windows forms is to make sure your data is being filled
correctly.

Or your building a stock ticker and the only fucntionality you want is to
change colors...
"Pacific Design Studios" <ER*******@paci ficdesignstudio s.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I have a DataGrid on Form1 that displays a small amount of information about employees.
On Form2 I want to have all the data displaying in text boxes about the
employee selected in the datagrid on form 1.
Is there a Id in the datagrid I can use to find out which user was selected or which record was highlighted when double clicked.
Something like: John Thomas Employee Id 2637 was selected on Form1 and the recordset on Form2 would use that Id as a variable in the recordset.

I know ASP quite well but I don't know how to do this in Windows Forms.

Thank you

ER*******@pacif icdesignstudios .com

Nov 19 '05 #5

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

Similar topics

4
2442
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected represents the indes of the actual DataGrid and not the DataView. For example.. Lets say I have 4 rows of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing a data row... I sort DESC so the rows display 4,3,2,1... If I...
2
5138
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element? Also, how can I associate all the attributes and their values of a particular element to the Name & Value columns of a datatable - to read into a datatable as well as write from the datatable to the xml element? Any help will be greatly...
8
3129
by: pei_world | last post by:
Hi, there; I have a problem with my datagrid control. I declared it in one of my form, set with DataGridTalbeStyle as well, and when I click on button, I would like to retrive Data from Database and bind these data to my datagrid in the form, when I click the button first time, it work fine. but when I click the second button. it report belowing error, I guess it is because it already set up the column name at first time, so cann't do...
0
3643
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
1
1515
by: Michael Gorbach | last post by:
Iv got a StatisticsContainer object that contains an arraylist of objects of different types, all inherited from class Statistic. The statistics class has 2 string public properties, name and stringValue. The classes that inherit from it use those two properties, plus several properties of their own of types double and vector. I need to display this StatisticsContainer class on a datagrid, but I'm having problems because each of the...
14
1834
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid will be used to populate information coming from a Webservice. (No datasets - No datareaders). So, I do not know see how to use the "datasource".
6
4686
by: Coleen | last post by:
Hi All :-) Thanks for all of your help Cor :-) I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message when I try this code: "Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier." Dim dr2 As DataRow = dt_stat_report_3b.NewRow Dim sum As Double =...
2
1321
by: Brad Shook | last post by:
First of all thinks to Cor Ligthert for helping me with this last week. If you wild like to read Cor's comments please refer to the posting from 10/14/2004 and 8:48AM "Help with Advanced Datagrid" I am trying to bind one column of a datagrid to a seperate textbox and the rest of the fields to a datagrid. the comments are too large to fit in a datagrid so I created a textbox below the datagrid and need it to hold the data for the...
3
2520
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and others. One of the custom format is as follows: dsmessages_dt.Columns.Add("Image", GetType(Image)) I had a problem of when I used a checkbox in the grid that was bound to the datatable that it would not update my dataset. So I created another...
4
2134
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click gets connected to the C# code,
0
8701
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,...
1
9066
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,...
0
9007
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6620
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
4459
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
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2101
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.