Results 1 to 7 of 7

Thread: [RESOLVED] Key ascii trouble and text1.text

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Resolved [RESOLVED] Key ascii trouble and text1.text

    Hi i'm using a Text1.text with following settings:
    1. Multiline
    2. Scrollbars, both

    And i got key ascii = 13, which enter the text i gave in text2.text.
    When i type in all my text until my Text1.text got scrollbars, everytime a new text appears in the text1.text it goes to the top so i have to scroll down to show my new message, any ideas?

    And two,
    Key ascii buttons works but sometimes it gets like this

    User:
    Text

    And sometimes (Right way) :

    User: Text

  2. #2
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Key ascii trouble and text1.text

    I don't have that prob.
    Does it happen when you type or are you send the ascii = 13 (vbCr) by code?

  3. #3
    Hyperactive Member danecook21's Avatar
    Join Date
    Feb 2008
    Location
    NC, USA
    Posts
    501

    Re: Key ascii trouble and text1.text

    After putting something in the textbox, do Text1.SelStart = Len(Text1.Text). it will move the cursor to the bottom, essentially scrolling it to the bottom.

  4. #4
    Hyperactive Member danecook21's Avatar
    Join Date
    Feb 2008
    Location
    NC, USA
    Posts
    501

    Re: Key ascii trouble and text1.text

    For the other problem I'm going to make a guess here and say you're making a chat program. If so, depending on how you handle the data, you may be receiving a vbCrLf after "User:" or you may be sticking one in there. Just do some checks on your code and see where it pops in.

  5. #5
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Key ascii trouble and text1.text

    If you're sending text from one box to the other and you want the new text added to the bottom then you need to set the SelStart property of the receiving textbox.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Key ascii trouble and text1.text

    danecook21, SelStart worked exellent, yes i think i have a vbcrlf after the coding, but strange that it works the first 1-2 times then it pops under the text, and your guess was right.. Yes I'm making a chat program.

  7. #7
    Hyperactive Member danecook21's Avatar
    Join Date
    Feb 2008
    Location
    NC, USA
    Posts
    501

    Re: Key ascii trouble and text1.text

    Glad to help. Yes it is strange. If you want we would be happy to take a look at the code if you want to post it or attach the project. Otherwise, just do some tests in your code and I'm sure you'll find why it's happening.

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