Results 1 to 12 of 12

Thread: Editing a string into 2 strings

Threaded View

  1. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: Editing a string into 2 strings

    For Shaggy :]
    Code:
    Dim letter As String
            Dim number As Integer
            letter = TextBox1.Text.Substring(0, 1)
            If Integer.TryParse(TextBox1.Text.Substring(1, TextBox1.TextLength - 1), number) = True Then
                Label1.Text = letter
                Label2.Text = number.ToString
            Else
                MessageBox.Show("Please enter the correct format.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning)
            End If
    Edit - And for JuggaloBrotha as well, woot woot!

    Edit #2 -
    When sending the SubString to the Integer.Parse(), you don't have to specify the length of the string to parse,
    I never knew that, I allways typed out the exact length. That would've saved me some trouble a while back :P
    Last edited by dday9; Jun 25th, 2012 at 01:11 PM.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

Tags for this Thread

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