472,371 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Scrolling DataGrid's selected row out of view selects next control

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.

Jul 7 '06 #1
3 2626
Brian,

This might work for you:

http://www.syncfusion.com/FAQ/Window...44c.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.

Jul 7 '06 #2

Kerry Moorman wrote:
Brian,

This might work for you:

http://www.syncfusion.com/FAQ/Window...44c.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.

Jul 7 '06 #3

Brian Tkatch wrote:
Kerry Moorman wrote:
Brian,

This might work for you:

http://www.syncfusion.com/FAQ/Window...44c.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.
OK, i think i got what i wanted.

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.

Jul 7 '06 #4

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

Similar topics

9
by: Lina | last post by:
Hi, Can anyone tell me if it is possible to add link buttons to a datagrid that has its source set to a datatable that i have created? i.e i want the user to be able to select a room from...
2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
3
by: David | last post by:
Hello, I have a datagrid populated with rows from a view. Because they are from a view, the rows are not actual database records, and therefore lack unique identifiers. So I have a command...
7
by: DJ Dev | last post by:
Hi All, I have a complex problem. I have dropdownlists (usually 3-5) and the user selects some value from these and for each value selected, datagrids are shown to the user. I am creating the...
0
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
1
by: JMann101 | last post by:
I am writing a ASP.NET(VB) application and am having some trouble. I have a datagrid which list users and when an admin clicks "edit" a defined column becomes visible and a dynamic listbox control...
6
by: Doug Bell | last post by:
Hi I have a datagrid with a combo box, I need to populate the combo with data dependant on the record value. eg for record 1, field Warehouse = 2R so combo would allow selection of locations...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.