Click here to Skip to main content
15,905,323 members
Home / Discussions / C#
   

C#

 
GeneralRe: Mouse Events in windows application C# Pin
musefan29-Apr-09 23:27
musefan29-Apr-09 23:27 
AnswerRe: Mouse Events in windows application C# Pin
Spunky Coder29-Apr-09 23:08
Spunky Coder29-Apr-09 23:08 
AnswerRe: Mouse Events in windows application C# Pin
Mycroft Holmes30-Apr-09 0:24
professionalMycroft Holmes30-Apr-09 0:24 
QuestionHow to select a specific cell? Pin
Saiyed Alam29-Apr-09 22:39
Saiyed Alam29-Apr-09 22:39 
AnswerRe: How to select a specific cell? Pin
Mycroft Holmes29-Apr-09 22:45
professionalMycroft Holmes29-Apr-09 22:45 
AnswerRe: How to select a specific cell? Pin
NickPace30-Apr-09 4:28
NickPace30-Apr-09 4:28 
QuestionSplit text file by Fixed Length Pin
yueru29-Apr-09 21:48
yueru29-Apr-09 21:48 
AnswerRe: Split text file by Fixed Length Pin
musefan29-Apr-09 21:54
musefan29-Apr-09 21:54 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:04
yueru29-Apr-09 22:04 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 22:10
musefan29-Apr-09 22:10 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:40
yueru29-Apr-09 22:40 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 22:46
musefan29-Apr-09 22:46 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:16
yueru29-Apr-09 23:16 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 23:28
musefan29-Apr-09 23:28 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:41
yueru29-Apr-09 23:41 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 23:56
musefan29-Apr-09 23:56 
GeneralRe: Split text file by Fixed Length [modified] Pin
yueru30-Apr-09 0:09
yueru30-Apr-09 0:09 
GeneralRe: Split text file by Fixed Length Pin
musefan30-Apr-09 0:36
musefan30-Apr-09 0:36 
GeneralRe: Split text file by Fixed Length Pin
OriginalGriff30-Apr-09 1:33
mveOriginalGriff30-Apr-09 1:33 
AnswerRe: Split text file by Fixed Length Pin
N a v a n e e t h29-Apr-09 21:58
N a v a n e e t h29-Apr-09 21:58 
QuestionRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:06
yueru29-Apr-09 22:06 
AnswerRe: Split text file by Fixed Length Pin
yueru5-May-09 21:23
yueru5-May-09 21:23 
Forget about Fixed length it's not my point
NOw I 've got the code
String inputfilename = "";
 private void Add(){

  StreamReader reader = new StreamReader(inputfilename);
            //MessageBox.Show(inputfilename);

            string line = reader.ReadLine();

            while (line != null)
            {
                string Date = line.Substring(12, 8);
                if (line.Substring(11, 1) == "=")
                {
                    string Time = line.Substring(21, 5);
                    string Linein = line.Substring(27, 10);
                    string Lineout = line.Substring(38, 1);
                    

                    if ((string.Compare(Lineout, "0") > 0 || string.Compare(Lineout, "0") == 0) && (string.Compare(Lineout, "9") < 0 || string.Compare(Lineout, "9") == 0))
                    {
                        //int g = line.Length;
                        //string Number = line.Substring(40, g - 40);
                        string Number = line.Substring(40, 20);
                        string Status = line.Substring(61, 3);
                         string Duration = line.Substring(65, 9);
                          string Cost = line.Substring(75, 3);
                         string Detail = line.Substring(79, 2);
                         string Network = line.Substring(82, 8);
                       // trim whitespace from both ends of the elements

                        string txtSQLQuery = "insert into par values('" + Date + "','" + Time + "','" + Linein + "','" + Lineout + "','" + Number + "','" + Status + "','" + Duration + "','" + Cost + "','" + Detail + "','" + Network + "')";
                        ExecuteQuery(txtSQLQuery);

                        //MessageBox.Show(line);


                        textBox6.Text = textBox6.Text + "\r\n" + Date + " " + Time + " " + Linein + " " + Lineout + " " + Number + " ";
                    }
                    else
                    {
                        textBox5.Text = line + "\r\n" + textBox5.Text;

                    }
                }
                else
                {
                    textBox5.Text = line + "\r\n" + textBox5.Text;
                }
                line = reader.ReadLine();
            }

            MessageBox.Show("End while loop");
        }

thx for all comment +_! Smile | :)
AnswerRe: Split text file by Fixed Length Pin
Mycroft Holmes29-Apr-09 21:59
professionalMycroft Holmes29-Apr-09 21:59 
AnswerRe: Split text file by Fixed Length Pin
Vasudevan Deepak Kumar29-Apr-09 22:33
Vasudevan Deepak Kumar29-Apr-09 22:33 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:24
yueru29-Apr-09 23:24 

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.