Click to See Complete Forum and Search --> : VB Form TextBox Command


Junday
December 12th, 2009, 08:51 PM
Strange title... but i wan't to explain your what i mean.

I have a form, with one textbox. This textbox should be useable with commands such as examples:

/title TITLE OF FORM

so the form title is TITLE OF FORM (without /title infront) - I have tried with splits, serveral of string formats and much more but without any luck and i don't seem to find it on google with search tags: TextBox, Command, Strings etc.

I hope you can help me with this, if you don't have any idea what i am talking about, you can ask in this thread and i can try to explain.

I use Visual Studio 2008 VB Form

HanneSThEGreaT
December 14th, 2009, 02:07 AM
Try something like this :
If InStr(TextBox1.Text, "/title") > -1 Then Me.Text = TextBox1.Text.Substring(TextBox1.Text.IndexOf(" ", 0))

This checks the existence of "/title" in the textbox text. If it exists, then it uses the substring method to split the string at the first occurence of a space character.

You could set up all these commands in an array, then simply use a loop to tracerse through all the items in the array