CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    6

    VB Form TextBox Command

    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
    Last edited by Junday; December 12th, 2009 at 09:58 PM.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: VB Form TextBox Command

    Try something like this :
    Code:
            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

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

Featured