Click here to Skip to main content
15,902,635 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to Sort Dataset ? Pin
E_Gold22-Mar-09 1:03
E_Gold22-Mar-09 1:03 
GeneralRe: How to Sort Dataset ? Pin
Henry Minute22-Mar-09 2:23
Henry Minute22-Mar-09 2:23 
Questionhow to split this text file Pin
rizchi21-Mar-09 21:29
rizchi21-Mar-09 21:29 
AnswerRe: how to split this text file Pin
Nagy Vilmos21-Mar-09 21:37
professionalNagy Vilmos21-Mar-09 21:37 
AnswerRe: how to split this text file Pin
Xmen Real 21-Mar-09 23:47
professional Xmen Real 21-Mar-09 23:47 
AnswerRe: how to split this text file Pin
#realJSOP22-Mar-09 0:08
professional#realJSOP22-Mar-09 0:08 
GeneralRe: how to split this text file Pin
rizchi22-Mar-09 12:19
rizchi22-Mar-09 12:19 
AnswerRe: how to split this text file Pin
Fayu23-Mar-09 4:41
Fayu23-Mar-09 4:41 
I am assuming that the '\' are the seperators. Here is the code:

string[] values = null;
using (DataTable dt = new DataTable())
{
    using (OpenFileDialog ofd1 = new OpenFileDialog())
    {
        DialogResult diagR = ofd1.ShowDialog();
        if (diagR == DialogResult.Cancel)
            return;

        using (StreamReader sr = new StreamReader(ofd1.FileName))
        {
            sr.BaseStream.Seek(0, SeekOrigin.Begin);
            bool headerLine = true ;
            while (!sr.EndOfStream)
            {
                values = sr.ReadLine().Split(Convert.ToChar(@"\"));
                if (headerLine)
                {
                    foreach (string s in values)
                    {
                        dt.Columns.Add(s);
                        headerLine =false ;
                    }
                }
                else
                {
                    DataRow dr = dt.NewRow();
                    for (int i = 0; i < values.Length; i++)
                    {
                        if (i > dt.Columns.Count - 1)
                            break;
                        dr[dt.Columns[i].ColumnName] = values.GetValue(i).ToString();
                    }
                    dt.Rows.Add(dr);
                    dt.AcceptChanges ();
                }
            }
        }
    }
}

Question[Message Deleted] Pin
rizchi21-Mar-09 21:25
rizchi21-Mar-09 21:25 
AnswerRe: how to split this text file? Pin
Nagy Vilmos21-Mar-09 21:44
professionalNagy Vilmos21-Mar-09 21:44 
QuestionDeployment Help (V S 2005) Pin
varun.g21-Mar-09 19:12
varun.g21-Mar-09 19:12 
Questionunable to get appropriate data from access database to crystal report in C# Pin
aashish.saalvi21-Mar-09 17:26
aashish.saalvi21-Mar-09 17:26 
Questionwhat is c# object graphs Pin
dream_liner_7e721-Mar-09 14:03
dream_liner_7e721-Mar-09 14:03 
AnswerRe: what is c# object graphs Pin
Mycroft Holmes21-Mar-09 14:39
professionalMycroft Holmes21-Mar-09 14:39 
Questioni want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 11:52
shomic.goyal21-Mar-09 11:52 
AnswerRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:18
fly90421-Mar-09 12:18 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 12:22
shomic.goyal21-Mar-09 12:22 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:24
fly90421-Mar-09 12:24 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 12:29
shomic.goyal21-Mar-09 12:29 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:38
fly90421-Mar-09 12:38 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 12:44
shomic.goyal21-Mar-09 12:44 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:48
fly90421-Mar-09 12:48 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
Yusuf21-Mar-09 13:06
Yusuf21-Mar-09 13:06 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 13:10
fly90421-Mar-09 13:10 
JokeRe: i want to make an ip messenger can i get the information related on my project Pin
Yusuf21-Mar-09 13:18
Yusuf21-Mar-09 13:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.