473,320 Members | 2,000 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,320 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 2916
"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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.