Click here to Skip to main content
16,012,759 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
It's Says Identifier Expected


Private Sub ComboBox2_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox8.KeyDown, TextBox6.KeyDown, TextBox5.KeyDown, TextBox3.KeyDown, TextBox2.KeyDown, DateTimePicker2.KeyDown, DateTimePicker1.KeyDown, ComboBox2.KeyDown
        If (e.KeyCode = Keys.Enter) Then

        End If
            if (Me .GetNextControl(ActiveControl, true)  != null)

            e.Handled = True
            Me.GetNextControl(ActiveControl, True).Focus()
        End If


What I have tried:

How to make Enter on a TextBox act as TAB button
Posted
Updated 12-Feb-18 1:28am
v2

1 solution

VB.NET has not != operator, it has instead the <> one. See, for instance VB.Net - Comparison Operators[^].
Also it doesn't have null, use Nothing instead.

The way to check for a null reference is (see vb.net - Null check in VB - Stack Overflow[^])
VB
If object isNot Nothing then
  '...
End If
 
Share this answer
 
v4
Comments
Shaddow>dark 12-Feb-18 7:35am    
Error 1 Operator '<>' is not defined for types 'System.Windows.Forms.Control' and 'System.Windows.Forms.Control'.

My new Error after update ???
Shaddow>dark 12-Feb-18 7:35am    
Private Sub ComboBox2_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox8.KeyDown, TextBox6.KeyDown, TextBox5.KeyDown, TextBox3.KeyDown, TextBox2.KeyDown, DateTimePicker2.KeyDown, DateTimePicker1.KeyDown, ComboBox2.KeyDown
If (e.KeyCode = Keys.Enter) Then

End If
If (Me.GetNextControl(ActiveControl, True) <> Nothing) Then

e.Handled = True
Me.GetNextControl(ActiveControl, True).Focus()
End If
Shaddow>dark 12-Feb-18 7:54am    
???????????????????????????????????
Dave Kreskowiak 12-Feb-18 12:04pm    
Really? How many times are you going to ignore what you've been told.
    If Me.GetNextControl(ActiveControl, True) IsNot Nothing Then
Maciej Los 12-Feb-18 16:35pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900