Re: Process data from bookmarked row of datagrid to text box
Originally Posted by Bobbles
Also 98% of pro's don't use the Data Environment.
That's crazy talk. If anything you have it backwards! Most of the casual plinkers still here have "learned" VB from copy/pasting creaky old VBScript snippets from ASP scripts. There was no way to pass the MCPD/MCSD exams without understanding how to use the DataEnvironment.
I think the problem with this stems from the way the DataGrid seizes control over its DataSource. When this is an ADO Recordset or a DataMember of a DataEnvironment the AbsolutePosition will always be changed back to 1.
As a result if you try to bind TextBox or other controls to the same source they can never move off the first row.
Bound TextBox controls are "stuck" on the first row
I attached a demo that creates a small Jet MDB on first run.
The only real way around this is to write event handlers for anything that binds new values or changes the row selection of the bottom-level DataGrid in the hierarchy. From there you can try to fish out the ID value for the selected row and use that for another query.
For example you could have a 3rd Command defined to accept this ID as a parameter. You'd have to close the Command's Recordset if open, then re-execute the Command passing this ID. Then you would have to bind each control to that Command's Recordset. Kind of ugly.
Plus you'd have to examine the EditMode value and conditionally call Update as each bound control loses focus. Also the DataGrid "one level up" would not be updated to reflect the change so you have another can of worms to deal with.
No, this just isn't a well conceived idea as far as I can determine. It may be a flaw in the way data binding was changed during the move to ADO, it may be a bug, or it may be intended behavior.
You are probably better off allowing the user to make edits within the DataGrid. Or rip out the DataGrids and replace them with MSHFlexGrids if they are just being used as row selection controls.
If there is a way to make what you ask for work I sure don't remember it. I can't find anything of the sort in the manuals or by trial and error for that matter either.
Don't expect a lot of help here. Most "professionals" have either moved on from VB to .Net or something else by now.