473,395 Members | 2,798 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,395 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 2920
"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: 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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.