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