Results 1 to 8 of 8

Thread: tab in a textbox

  1. #1
    Guest
    If the focus is on a textbox, and you press TAB, the focus will goto the next control. How do I get it so that the TAB key will actually get me an indent in the textbox rather than going onto the next control?

    Sunny

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question Explain more please..

    I Dont really understand by "indent" what is it you are trying to accomplish?
    explain more...

  3. #3
    Hyperactive Member
    Join Date
    Dec 1999
    Posts
    321

    Textboxes are poor


    Use a RichTextBox instead...
    Signed, Rodik ([email protected])
    Programmer,usesVB6ED
    ===========================
    Copyright©RodikCo,2002.

    Dont mind this signature ;] Its old

  4. #4
    Guest
    For example:

    <indent>Then I start typing.

    <indent>In normal WPs, indents are done by pressing TAB, but in a text box in VB, when you press TAB, the focus jumps to the next control, rather than giving an indent.

    btw, 'indent' is the proper name for the 'space before a paragraph'


    Sunny

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Code:
    Option Explicit
    
    Sub toggleTabStops()
    Dim ctrl As Control
      
      For Each ctrl In Me.Controls
        ctrl.TabStop = Not ctrl.TabStop
      Next
    
    End Sub
    Private Sub Text1_GotFocus()
      toggleTabStops
    End Sub
    
    Private Sub Text1_LostFocus()
      toggleTabStops
    End Sub
    Mark
    -------------------

  6. #6
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    you could also test the keyascii argument in the keypress event of the text box for the ascii value of TAB which is 9, and then ignore it (KeyAscii = 0) and then type a coupla spaces. Ur choice.

    [Edited by Mag-Net on 07-18-2000 at 05:53 AM]
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  7. #7
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Have you actually tried that Mag-Net?

    firstly tab is 9
    8 is backspace

    secondly, neither keypress nor KeyDown events get fired when the tab key is pressed and there are other controls on the form with tabstop = true








    Mark
    -------------------

  8. #8
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    okay, okay, i havent tried it, it was just a suggestion. Your idea is much better, and i mis-typed the 9, which i have now corrected.
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width