Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jan 22nd, 2010, 5:11 PM   #1
Johnboy
Programmer
 
Join Date: Feb 2009
Posts: 84
Rep Power: 2 Johnboy is on a distinguished road
separating numbers from strings

The following code below, reads a file with a numbers listed in a line separated by a comma. I print this then into a textbox. What i want to know, is how do I separate the numbers from the commas so i can place them into an array. Help please!

private void YearlyData()
        {
           string filePath = @"rainfall.txt";
           string line;
 
           if (File.Exists( filePath ))
           {
                StreamReader file = null;
                try
                {
                   file = new StreamReader( filePath );
                   while ((line = file.ReadLine()) != null)
                    {
                        textBoxList.Text = line;
                   }
                }
                finally
                {
                   if (file != null)
                       file.Close();
                }
           }
           
        }
Johnboy is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Positive and Negative numbers - won't compile "if" or "else" statements 3dserge C++ 13 Feb 26th, 2009 11:41 AM
VB.net Caluclating pythagorean numbers help bulio Visual Basic .NET 5 Oct 26th, 2008 5:14 PM
How to store 5 numbers from a file into 5 seperate variables? kewlgeye Java 8 Jun 26th, 2008 2:09 PM
code to add numbers in an array truBlu1 Java 9 Oct 12th, 2007 10:08 PM
random Numbers in openGL csrocker101 C++ 5 Apr 24th, 2007 8:02 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:36 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC