473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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*******@pacificdesignstudios.com
Nov 19 '05 #1
4 2183
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 DataGridTextColumn and the DataGridBoolColumn. 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*******@pacificdesignstudios.com> wrote in
message news:%2****************@TK2MSFTNGP12.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*******@pacificdesignstudios.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*********@yahoo.com> wrote in message
news:Om**************@TK2MSFTNGP10.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 DataGridTextColumn and the DataGridBoolColumn. 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*******@pacificdesignstudios.com> wrote in
message news:%2****************@TK2MSFTNGP12.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*******@pacificdesignstudios.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*******@pacificdesignstudios.com> wrote in
message news:%2****************@TK2MSFTNGP12.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*******@pacificdesignstudios.com

Nov 19 '05 #5

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

Similar topics

4
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...
2
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?...
8
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...
0
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...
1
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...
14
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...
6
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...
2
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...
3
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.