473,394 Members | 1,870 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,394 software developers and data experts.

Moving to a field in a grid

I have a grid with, lets say, 3 fields in it, Debit, Credit and Comments, in
that order. When the user moves to the debit field, if he enters data in
it, I would like for the cursor to skip past the Credit field to the
comments field. I have a ColumnChanging event where I trap to see what
field the user is on. I trap for the user being on the Debit field. I have
code that , in my mind should cause the cursor to move to the Comments
field, but it is not working. The line looks like this:

dg_AR.ActiveCell = dg_AR.ActiveRow.Cells("Comments")

The syntax here is indegineous to Infragistics but if you will not tune me
out, I think the question is best answered here. Actually, the cusor does
move to the Comments field. I know this because although it is very quick,
if I look closely I actually see it happen, the problem is that after it
moves to the Comments field, it then moves to the field it would ordinarily
move to - the credit field.

I think I understand what is happening but don't know how to solve it. In
the environment I came from prior to VS (PowerBuilder) there was the concept
of a Post event. If you have an event you want to fire and you make it a
Post event, it is gauranteed to run at the end of everything else, i.e,
after all other internal events fire. I think this is why my code isn't
working in VS. Something is firing after my call for an explicit move. I
think I remember seeing the equivelent of a Post event in VS but I can not
find a reference to it in my notes. If there is such a thing could someone
point me to it and tell me how to use it?

If someone can see that solution lies elsewhere could you point me to that?

Thank you.
Nov 20 '05 #1
4 2280
Hi Woody,

What do you mean by grid?
Is it a Datagrid control in VB.NET in a winform application.
Based on my understanding, what you want to do is when you hit Tab key in
column 0,i.e. fields 1 in your words, the cursor will move to the column 2,
i.e. fields 3.
Did I misunderstand your meaning?
If you have any related question, please post here.

Here I write some code for you.

You can handle the CurrentCellChanged event.
To let the mouse select the column 1, i.e. the second field, set the flag
variable.

Dim flag As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
flag = False
End Sub
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
If DataGrid1.CurrentCell.ColumnNumber = 1 Then
If flag Then
flag = False
Else
DataGrid1.CurrentCell = New
DataGridCell(DataGrid1.CurrentCell.RowNumber, 2)
End If
End If
End Sub
Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown
Dim ht As DataGrid.HitTestInfo = DataGrid1.HitTest(e.X, e.Y)
If ht.Column = 1 Then
flag = True
Else
flag = False
End If
End Sub
dg_AR.ActiveCell = dg_AR.ActiveRow.Cells("Comments") what is the dg_AR object, is it a datagrid?

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------From: "Woody Splawn" <wo***@splawns.com>
Subject: Moving to a field in a grid
Date: Tue, 21 Oct 2003 08:26:18 -0700
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <e6**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.surewest.net 66.60.158.168
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:148687
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I have a grid with, lets say, 3 fields in it, Debit, Credit and Comments, inthat order. When the user moves to the debit field, if he enters data in
it, I would like for the cursor to skip past the Credit field to the
comments field. I have a ColumnChanging event where I trap to see what
field the user is on. I trap for the user being on the Debit field. I havecode that , in my mind should cause the cursor to move to the Comments
field, but it is not working. The line looks like this:

dg_AR.ActiveCell = dg_AR.ActiveRow.Cells("Comments")

The syntax here is indegineous to Infragistics but if you will not tune me
out, I think the question is best answered here. Actually, the cusor does
move to the Comments field. I know this because although it is very quick,
if I look closely I actually see it happen, the problem is that after it
moves to the Comments field, it then moves to the field it would ordinarily
move to - the credit field.

I think I understand what is happening but don't know how to solve it. In
the environment I came from prior to VS (PowerBuilder) there was the conceptof a Post event. If you have an event you want to fire and you make it a
Post event, it is gauranteed to run at the end of everything else, i.e,
after all other internal events fire. I think this is why my code isn't
working in VS. Something is firing after my call for an explicit move. I
think I remember seeing the equivelent of a Post event in VS but I can not
find a reference to it in my notes. If there is such a thing could someone
point me to it and tell me how to use it?

If someone can see that solution lies elsewhere could you point me to that?

Thank you.


Nov 20 '05 #2
Thanks for responding Peter
What do you mean by grid?
Is it a Datagrid control in VB.NET in a winform application.


Yes it is a datagrid. Specifically a Infragistics UltraGrid.
dg_AR.ActiveCell = dg_AR.ActiveRow.Cells("Comments")

what is the dg_AR object, is it a datagrid?


Yes Dg_AR is the name of the datagrid.

I think you have the idea of what I am trying to do. However, because this
is a UltraGrid, it does not have a CurrentCellChanged Event. But whether it
does or not my main question is this:

Is it possible to call a subroutine in a way that will cause it (the sub
routine) to fire after all other built-in Visual Studio events have fired?
I thought I remembered reading that you could do this in VS but I don't
remember where I saw it or how to implement it if it exists.


Nov 20 '05 #3
Hi Woody,
I think you have the idea of what I am trying to do. However, because this
is a UltraGrid, it does not have a CurrentCellChanged Event. But whether it
It seems that the UltraGrid has the AfterCellActivate event, you may trap
it and handle the event to achieve your aim.
does or not my main question is this:

Is it possible to call a subroutine in a way that will cause it (the sub
routine) to fire after all other built-in Visual Studio events have fired?
I thought I remembered reading that you could do this in VS but I don't
remember where I saw it or how to implement it if it exists. I think there is no such method in .NET

If you have any related question, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------From: "Woody Splawn" <wo***@splawns.com>
References: <e6**************@TK2MSFTNGP09.phx.gbl> <zI*************@cpmsftngxa06.phx.gbl>Subject: Re: Moving to a field in a grid
Date: Wed, 22 Oct 2003 17:07:04 -0700
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uB**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.surewest.net 66.60.158.168
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:149302
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Thanks for responding Peter
What do you mean by grid?
Is it a Datagrid control in VB.NET in a winform application.
Yes it is a datagrid. Specifically a Infragistics UltraGrid.
>dg_AR.ActiveCell = dg_AR.ActiveRow.Cells("Comments")

what is the dg_AR object, is it a datagrid?


Yes Dg_AR is the name of the datagrid.

I think you have the idea of what I am trying to do. However, because this
is a UltraGrid, it does not have a CurrentCellChanged Event. But whether

itdoes or not my main question is this:

Is it possible to call a subroutine in a way that will cause it (the sub
routine) to fire after all other built-in Visual Studio events have fired?
I thought I remembered reading that you could do this in VS but I don't
remember where I saw it or how to implement it if it exists.



Nov 20 '05 #4
Hi Woody,

If you have any question on this issue please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #5

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

Similar topics

2
by: Manfred | last post by:
Hi Would like to add a new Field to Table which is 75 % (or another Percentage) higher than the Value in another Field in same Table.Is this possible with Expression or would I have to enter the...
3
by: Bill Clark | last post by:
I have about 20,000 records pulled from Excel that I need to update. What I need to do is run an update query that bascially says: If a field is null, update it with the previous record value of...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
0
by: Philip Rayne | last post by:
I have populated a datagrid with the contents on an XML file. I have created 2 buttons on my form "Move Up" and "Move Down". I would like these buttons to physically move a row up and down the...
1
by: I_AM_DON_AND_YOU? | last post by:
Here is the simple one. When we move the controls like CheckBox, Radio Button etc. they move on the grid (from one grid to another). Whether is option where I can check or uncheck the movement...
5
by: graphicsxp | last post by:
Hi, I've added a linkbutton field to my gridview. Now I would like that when the user clicks on it for a particular row, a server-side function should be executed, which takes as parameters the id...
1
by: SyddyS | last post by:
Hi all, please help ASAP! Well, it's been a long and bumpy ride, but my little Access DB is finally graduating and moving out of the house. My homebrewed contact and sales database is being...
1
by: John | last post by:
Hi I have a grid view bound to an SqlDataSource. One of the fields in grid view is a hyperlink field. How can I set the hyperlink field's navigationurl to the value of a field coming form the...
15
by: mcjason | last post by:
I saw something interesting about a grid pair puzzle problem that it looks like a machine when you find each that work out the way it does and say with all the others that work out the way they...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.