TextBox Cursor

Discussion in 'Questions (Windows Mobile)' started by RandomCoder, Jul 2, 2007.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    I'm in need of some :sign0085:

    My editable table program (http://www.basic4ppc.com/forum/showthread.php?t=487) could be made better if the data in the TextBox was highlighted ready to be overwritten with new data.

    This seems to have got the better of me even though I'm certain it must be possible.
    So far I've tried turning the Focus onto the TextBox but this didn't work, I then tried selecting whatever data was in the TextBox but still no joy.
    What else is there to do :confused:

    Anyway, here's what I've already tried....
       TextBox1.SelectionLength= StrLength(TextBox1.Text)
    Any takers on what I'm doing wrong?

  2. Cableguy

    Cableguy Expert Licensed User

    Well randomcoder,

    For starters, the focus method does NOT require to be True or False.
    The correct syntax is textbox1.focus.

    With that corrected it works fine, the text in textbox1 gets highlighted...Both on desktop(no code needed) ond ppc(with the code).
  3. specci48

    specci48 Well-Known Member Licensed User

    Hi RandomCoder,

    I took my posted EditableTablev1.1 and changed the Sub Timer_Tick into
    Sub Timer1_Tick
        Timer1.Enabled = 
        TextBox1.SelectionLength = StrLength(TextBox1.Text)
    End Sub
    I don't know why this must be done out of the SelectionChanged sub. :(

  4. RandomCoder

    RandomCoder Well-Known Member Licensed User


    I feel that you are my friend and we joined roughly the same time but just so that you know, I did try TextBox1.Focus but that didn't work and so I used the full syntax just to try and dot all the i's and cross all the t's as it were.
    You obviously didn't try it in my EditableTable App as it definitely does not work :(


    Thank you, you've come to my rescue :sign0060:
    The SelectionChanged Sub must have been keeping hold of the Focus.
    The only problem now is that I suspect that I won't be able to use the arrow keys on the SIP to navigate around the table since the Focus is no longer on the Selected Cell.
    I'll have to try this on the device to confirm this but at the moment am just putting my kids to bed.

  5. Cableguy

    Cableguy Expert Licensed User

    You are rigth ...and wrong...

    I didn't try it in you editable table, I tryed it in a blankform with only a texbox in it, and it works...
    In you first post you didnt specified that this was to be in the selection change event....

    I never doubt of you skills as myself make a few dumb mistakes once in a while....

    Never the less, Im glad your prob is solved....
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice