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.