473,385 Members | 1,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Splitting a line by comma in VB

Hi, i'm a very new user to visual basic and i am looking to split a line like: Isaac, 1.2, 1.8, 1.9, 1.5, 1.6, 1.7, into multiple lines. So far i have:
line.Split(",")
but this doesn't split into into new lines and when i attempt to use & vbnewline it still won't work. I'd really appreciate any help if you have it.
Jan 20 '15 #1
2 1164
Frinavale
9,735 Expert Mod 8TB
The String.Split method returns an array of strings.

You need to loop through the array and add each component to a new string and insert newlines in between each component.

Or better yet use a StringBuilder(<--see this for documentation and examples)

Or you could try using the String.Replace method to replace all of the commas with Environment.Newline (however I'm not 100% sure this will work).

-Frinny
Jan 20 '15 #2
!NoItAll
297 100+
Expand|Select|Wrap|Line Numbers
  1. Dim Lines() as String
  2. Lines = myString.Split(",")
  3. For Each Line as String in Lines
  4.    'do something with each line
  5. Next
  6.  
Jan 30 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: robsom | last post by:
Hi, I have a problem with a small python program I'm trying to write and I hope somebody may help me. I'm working on tables of this kind: CGA 1988 06 21 13 48 G500-050 D 509.62 J.. R1 1993 01...
3
by: Brad Joss | last post by:
Scenario: Table 1 (a id, b name) Table 2 (a FKid, d value) A standard join on a gives me something like: a1 b1 d1 a1 b1 d2 What I want is:
3
by: SteelDetailer | last post by:
Thnaks in advance for considering this post. It's probably very simple, but..... I have an old VB6 application that allows me to create, save and edit a "project information file" that is a...
3
by: Gary Smith | last post by:
Hi, I've got a field that contains a list of rooms. In most cases, this contains a single ID. However, under some circumstances, the field may contain a list of two IDs which are broken by a...
2
by: Trint Smith | last post by:
Ok, My program has been formating .txt files for input into sql server and ran into a problem...the .txt is an export from an accounting package and is only supposed to contain comas (,) between...
1
by: Hennie7863 | last post by:
Hi i want to create a table as follows : if exists (select * from dbo.sysobjects where id = object_id(N'') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table GO Create table...
9
by: acatejr | last post by:
I have a text file and each line is a list of values. The values are not delimited, but every four characters is a value. How do I get python to split this kind of data? Thanks.
3
by: MSNEWS | last post by:
Hi i need to extract all items between commas into a string array from the following line, but there is a comma in one of the items (between strings) eg "MICHEAL JACKSON, AAMC" , i used...
2
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to...
1
by: santhanalakshmi | last post by:
Hi, I am opening the "text file" and writing in that text file using VB. For example: mystring="Hi,how are you?,fine" 'writing in text file
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.