Problem with Shift-Tab and Custom Usercontrol's


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Problem with Shift-Tab and Custom Usercontrol's

Hybrid View

  1. #1
    Tony Mancuso Guest

    Problem with Shift-Tab and Custom Usercontrol's


    Hello,

    I have created a Usercontrol that has 3 textboxes in it. On my Form I place
    a textbox with Tabindex = 0, then I place my Usercontrol with Tabindex =
    1 and then another textbox with Tabindex = 2. If I use the Tab key to navigate
    through the form everything is fine, but once you start to use Shift-Tab
    the focus always goes to the First textbox in my Usercontrol. I haven't
    been able to figure out how to get the focus to go to the Third textbox in
    my Usercontrol. If anyone can help me I would greatly appreciate it.
    Tony.

  2. #2
    Rohit Wason Guest

    Re: Problem with Shift-Tab and Custom Usercontrol's


    Tony,
    Here is a dirty one. It works with tab/shift-tab, but there is a hunch, if
    the user uses mouse to set the focus:

    In the UserControl, add a custom variable property:

    Public ShiftTab As Boolean

    and in the EnterFocus Event:

    Private Sub UserControl_EnterFocus()
    If m_blnShiftTab Then
    Text3.SetFocus
    End If
    End Sub


    In the form, suppose text1 and text2 are the predecessor and successor control
    (in terms of tabIndex):

    Private Sub Text1_GotFocus()
    UserControl11.ShiftTab = False
    End Sub

    Private Sub Text2_GotFocus()
    UserControl11.ShiftTab = True
    End Sub

    This works fine with keyboard, but fails if the user explicitely uses mouse
    to set the focus.

    HTH, you may need to work further to overcome the mouse-problem
    Cheers,
    Rohit



    "Tony Mancuso" <Antonio.Mancuso@m3isystems.com> wrote:
    >
    >Hello,
    >
    >I have created a Usercontrol that has 3 textboxes in it. On my Form I place
    >a textbox with Tabindex = 0, then I place my Usercontrol with Tabindex =
    >1 and then another textbox with Tabindex = 2. If I use the Tab key to navigate
    >through the form everything is fine, but once you start to use Shift-Tab
    >the focus always goes to the First textbox in my Usercontrol. I haven't
    >been able to figure out how to get the focus to go to the Third textbox

    in
    >my Usercontrol. If anyone can help me I would greatly appreciate it.
    >Tony.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center