Jump to content

Limit the user chat.


Recoil

Recommended Posts

It seems like I am running into issues with every simple task...

Declared a global:

Public Const MyTextLength As Integer = 70

Now I need to check what the user is typing:

' Check for IsTalking = True, continue with the rest of this...
' Check for Keys.Enter and do stuff
' Check for Keys.Back and delete a letter from MyText

If MyText.Length = MyTextLength Then
        Exit Sub
End If

' Check for other keys...

I'm setting a small limit for testing.  When I bypass the length check everything works fine.  When I include the above check before checking the rest of the keys, when I hit [Enter] to send the text (if it was typed over the limit) it starts the whole  disconnecting deal over again.  I have tried several variations of the above but running into walls.

I could use an idea on how to check the length of MyText to limit the number of characters the user can input.

Link to comment
Share on other sites

Stop trying to limit it. Instead, make it so that if they reach as certain number of characters, it starts cutting parts off of the beginning of the string (only visually) so it gives a scrolling effect.

Then maybe decide to limit it if it gets really obnoxious like 300 characters+ or so.

Link to comment
Share on other sites

No, I have it scrolling to adjust the view of the text working, what I meant was catching the limit of the MyTextLength.  When I type over the amount and hit enter to send it, it errors for some reason but isn't showing anything.  When I bypass the char limit, everything works fine, but just has unlimited characters that can be input.

Link to comment
Share on other sites

No, it isn't with the packets.  I figured it out though.  I had two if statements...one to check for Enter or backspace, then another to check the rest of the keys.  All I had to do was move that to the first if statement and it worked <.<

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...