|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Scrolling DataGrid's selected row out of view selects next controlStored PROCEDURE calls. That is, when a record is selected on the first grid, a stored PROCEDURE is CALLed to Fill() the next second DataGrid's DataSource. All that works very well. And, when there are no records to display, it is simply left blank. My issue is that when i scroll the first one, sometimes the second grid shows a bunch of null values (a "new" record). After a little study, i realized the problem happens when there are no records to show in the second grid, and the first grid is scrolled so that the currently selected row (as indictated by Black Right-Pointing Pointer (as Charmap calls it)) goes off the screen. This causes the second grid to be automatically selected (as the now showing Black Right-Pointing Pointer indicates) but because there are no records, it starts a new one. This is the same issue as having a blank DataGrid as the first control in a Form's TabIndex. It will start a new record immediately. The question is, how do i prevent this from happening? Starting a new record needs to be possible manually, it should just not be started automatically. And i would like the keep eacdh grid as a TabStop, and lkeep the current order of TabIndexing. B. Brian,
This might work for you: http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q653q Kerry Moorman Show quoteHide quote "Brian Tkatch" wrote: > I have a form with two DataGrids, which are kept in sync manually via > Stored PROCEDURE calls. That is, when a record is selected on the first > grid, a stored PROCEDURE is CALLed to Fill() the next second DataGrid's > DataSource. All that works very well. And, when there are no records to > display, it is simply left blank. > > My issue is that when i scroll the first one, sometimes the second grid > shows a bunch of null values (a "new" record). > > After a little study, i realized the problem happens when there are no > records to show in the second grid, and the first grid is scrolled so > that the currently selected row (as indictated by Black Right-Pointing > Pointer (as Charmap calls it)) goes off the screen. This causes the > second grid to be automatically selected (as the now showing Black > Right-Pointing Pointer indicates) but because there are no records, it > starts a new one. > > This is the same issue as having a blank DataGrid as the first control > in a Form's TabIndex. It will start a new record immediately. > > The question is, how do i prevent this from happening? Starting a new > record needs to be possible manually, it should just not be started > automatically. And i would like the keep eacdh grid as a TabStop, and > lkeep the current order of TabIndexing. > > B. > > Kerry Moorman wrote:
Show quoteHide quote > Brian, Much appreciated.> > This might work for you: > > http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q653q > > Kerry Moorman > > > "Brian Tkatch" wrote: > > > I have a form with two DataGrids, which are kept in sync manually via > > Stored PROCEDURE calls. That is, when a record is selected on the first > > grid, a stored PROCEDURE is CALLed to Fill() the next second DataGrid's > > DataSource. All that works very well. And, when there are no records to > > display, it is simply left blank. > > > > My issue is that when i scroll the first one, sometimes the second grid > > shows a bunch of null values (a "new" record). > > > > After a little study, i realized the problem happens when there are no > > records to show in the second grid, and the first grid is scrolled so > > that the currently selected row (as indictated by Black Right-Pointing > > Pointer (as Charmap calls it)) goes off the screen. This causes the > > second grid to be automatically selected (as the now showing Black > > Right-Pointing Pointer indicates) but because there are no records, it > > starts a new one. > > > > This is the same issue as having a blank DataGrid as the first control > > in a Form's TabIndex. It will start a new record immediately. > > > > The question is, how do i prevent this from happening? Starting a new > > record needs to be possible manually, it should just not be started > > automatically. And i would like the keep eacdh grid as a TabStop, and > > lkeep the current order of TabIndexing. > > > > B. > > > > That actually was not what i wanted. But it got me thinking. :) Since the scroll is making the first grid to lose focus.... In the scroll even of the DataGrid i added "sender.Select()". This returns focus to the DataGrid which removes the "new" record from the following grid. Unfortunately, the other DataGrid does get Focus for a second and the nulls are sometimes seen. B. Brian Tkatch wrote:
Show quoteHide quote > Kerry Moorman wrote: OK, i think i got what i wanted.> > Brian, > > > > This might work for you: > > > > http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q653q > > > > Kerry Moorman > > > > > > "Brian Tkatch" wrote: > > > > > I have a form with two DataGrids, which are kept in sync manually via > > > Stored PROCEDURE calls. That is, when a record is selected on the first > > > grid, a stored PROCEDURE is CALLed to Fill() the next second DataGrid's > > > DataSource. All that works very well. And, when there are no records to > > > display, it is simply left blank. > > > > > > My issue is that when i scroll the first one, sometimes the second grid > > > shows a bunch of null values (a "new" record). > > > > > > After a little study, i realized the problem happens when there are no > > > records to show in the second grid, and the first grid is scrolled so > > > that the currently selected row (as indictated by Black Right-Pointing > > > Pointer (as Charmap calls it)) goes off the screen. This causes the > > > second grid to be automatically selected (as the now showing Black > > > Right-Pointing Pointer indicates) but because there are no records, it > > > starts a new one. > > > > > > This is the same issue as having a blank DataGrid as the first control > > > in a Form's TabIndex. It will start a new record immediately. > > > > > > The question is, how do i prevent this from happening? Starting a new > > > record needs to be possible manually, it should just not be started > > > automatically. And i would like the keep eacdh grid as a TabStop, and > > > lkeep the current order of TabIndexing. > > > > > > B. > > > > > > > > Much appreciated. > > That actually was not what i wanted. But it got me thinking. :) > > Since the scroll is making the first grid to lose focus.... > > In the scroll even of the DataGrid i added "sender.Select()". This > returns focus to the DataGrid which removes the "new" record from the > following grid. > > Unfortunately, the other DataGrid does get Focus for a second and the > nulls are sometimes seen. > > B. 1) Add a class-wide boolean variable: Dim Scrolling As Boolean 2) In the Scroll event of the DataGrid set it: Scrolling = True 3) In the Validating event of the DataGrid, if it is set, unset it and cancel the event. If Scrolling Then Scrolling = False e.Cancel = True End If The only issue right now, is that if the first thing done when it comes up is a scroll (that is, the user scroll before effecting any other event), it still shows the null record the first time it is passed (even if the user scrolls many times). B.
Date Sort
Sharing Class Data With Multiple Forms Urgent! Get rowindex - datagrid navigation Need to capture all keystrokes to my application Difference between MyBase and Me How to Get DataSet ot DataTable from DataGrid Limit bandwith of my application VB Net 2005 and Email! combobox view display width question Images in a Windows DataGrid |
|||||||||||||||||||||||