Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. doubt in VB.Net "split" method

doubt in VB.Net "split" method

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MS Lee
    wrote on last edited by
    #1

    hi friendz, i hv a doubt in VB.Net i hv a string as "jacab,martin" i want to split it and assign it in FirstName = jacab, SecondName = martin i used "split" method, but for me it doesn't work, is there anyother way t get my result?

    self confidence+hard work=SUCCESS

    M 1 Reply Last reply
    0
    • M MS Lee

      hi friendz, i hv a doubt in VB.Net i hv a string as "jacab,martin" i want to split it and assign it in FirstName = jacab, SecondName = martin i used "split" method, but for me it doesn't work, is there anyother way t get my result?

      self confidence+hard work=SUCCESS

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Try this Dim arNames() As String = Split("james,martin", ",") Dim sName As String = arNames(0) Dim fName As String = arNames(1)

      M 1 Reply Last reply
      0
      • M Mycroft Holmes

        Try this Dim arNames() As String = Split("james,martin", ",") Dim sName As String = arNames(0) Dim fName As String = arNames(1)

        M Offline
        M Offline
        MS Lee
        wrote on last edited by
        #3

        THANKS A LOT, THIS ALSO WORKIONG YAAR, Dim memberName(2) As String Dim memberLName As String Dim memberFName As String memberName = memberNameTextBox.Text.Split(“,”) memberLName = memberName(0).Trim memberFName memberName(1).Trim

        self confidence+hard work=SUCCESS

        M 1 Reply Last reply
        0
        • M MS Lee

          THANKS A LOT, THIS ALSO WORKIONG YAAR, Dim memberName(2) As String Dim memberLName As String Dim memberFName As String memberName = memberNameTextBox.Text.Split(“,”) memberLName = memberName(0).Trim memberFName memberName(1).Trim

          self confidence+hard work=SUCCESS

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          Just a minor issue, this produces a 3 element array 0,1,2 Dim memberName(2) As String This is not relevant to your current code but will trip you if you ever use memberName.lenght (which is 3 NOT 2)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups