472,789 Members | 1,087 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,789 software developers and data experts.

Overriding ProcessTabKey stops tab working in VB.NET

Hi,

I have several controls on one VB.NET form, which uses the tabindex to set
the focus in the correct order when tab is pressed. However, if "Yes" is
selected in combo1, and tab is pressed then I want to tab straight to
combo3. Otherwise, the tabbing should behave as normal.

Tab isn't detected on KeyPress or KeyDown events, so I tried this...
Protected Overrides Function ProcessTabKey(ByVal forward As Boolean) As
Boolean

If combo1.Focused and combo1.Text = "Yes" Then
Combo3.Focus()
Else
'Return False ??
'MyClass.ProcessTabKey(forward) ??
'Me.ProcessTabkey(forward) ??
End If

End Function
....Which works fine when the focus is on combo1 and the text is "Yes", but
when focus is with any other control, pressing tab doesn't work, i.e. the
focus stays where it is.

I think I need to call the parent class which I've overridden to pass any
other condition to be handled normally, but don't know how.

In the above example, "Return False" does nothing, and the other two cause a
StackOverflow, as it's just calling itself rather than back to the base
class.

I remember in Java you could call "this" to pass back to the parent class.

Setting KeyPreview on the form at design time seems to have no effect either

Any ideas how you do it in VB.NET?

Thanks, Steve
Jul 22 '05 #1
2 2883
"Steve Harrison" <ma**@steve.harrison.name> schrieb
Hi,

I have several controls on one VB.NET form, which uses the tabindex
to set the focus in the correct order when tab is pressed. However,
if "Yes" is selected in combo1, and tab is pressed then I want to
tab straight to combo3. Otherwise, the tabbing should behave as
normal.

Tab isn't detected on KeyPress or KeyDown events, so I tried this...
Protected Overrides Function ProcessTabKey(ByVal forward As
Boolean) As Boolean

If combo1.Focused and combo1.Text = "Yes" Then
Combo3.Focus()
Else
'Return False ??
'MyClass.ProcessTabKey(forward) ??
'Me.ProcessTabkey(forward) ??
End If

End Function
...Which works fine when the focus is on combo1 and the text is
"Yes", but when focus is with any other control, pressing tab
doesn't work, i.e. the focus stays where it is.

I think I need to call the parent class which I've overridden to
pass any other condition to be handled normally, but don't know how.

In the above example, "Return False" does nothing, and the other two
cause a
StackOverflow, as it's just calling itself rather than back to the
base class.

I remember in Java you could call "this" to pass back to the parent
class.

Setting KeyPreview on the form at design time seems to have no
effect either

Any ideas how you do it in VB.NET?

....
else
return mybase.processtabkey(forward)
end if

See also:
http://msdn.microsoft.com/library/en...ingMethods.asp
(same via <F1>)
Armin

Jul 22 '05 #2
I think I need to call the parent class which I've overridden to pass any
other condition to be handled normally, but don't know how.


You want MyBase.ProcessTabKey(forward), I think

MyBase is the VB.NET keyword that is used to call back to a parent
class - you will often see it crop up in overriden procedures.

--
Larry Lard
Replies to group please

Jul 22 '05 #3

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

Similar topics

0
by: sam | last post by:
I am running win2k3, iis6, access db's, for a web app. The problem is that asp stops working randomly. No errors in IIS log, no errors in even viewer. It just stops serving asp. Restarting IIS...
1
by: Steve | last post by:
I have almost got this no touch deployment of WinForms working Except... 1) Occasionally the launching of the application stops and I get the IE Message "The page cannot be found". If I restart...
3
by: news.microsoft.com | last post by:
Hi, It is possible to override a non virtual method with the "new" keyword So how is this different from specifying a method as virtual then providing the override keyword? Is there any...
2
by: Martin Hjärtmyr | last post by:
I have a program that uses Hotkeys! And they works just fine! I use this hotkeylib:...
2
by: ESPNSTI | last post by:
Hi, I'm very new to C# and .Net, I've been working with it for about a month. My experience has been mainly with Delphi 5 (not .Net). What I'm looking for is for a shortcut way to override a...
2
by: Nikhil Patel | last post by:
Hi all, I installed an asp.net application on a client's machine on Friday. It uses a Sql Server database as backend. Database server and Web server are on different machines but same domain. The...
2
by: Steve Harrison | last post by:
Hi, I have several controls on one VB.NET form, which uses the tabindex to set the focus in the correct order when tab is pressed. However, if "Yes" is selected in combo1, and tab is pressed...
6
by: Ben | last post by:
I'm having a really hard time trying to figure out how to override the drawing in my class derived from Button. When I set the text property, the drawing seems to be taking place in the set...
3
by: Bill Fuller | last post by:
I have an application that is modifying the ENTER key to use this.ProcessTabKey() for data entry screens (replacing a green-screen Telenet app). I would like to do the equivilent of...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.