Results 1 to 4 of 4

Thread: Liststring more then 1 variable

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    115

    Liststring more then 1 variable

    I wont to grab few lines from a text in to my textbox and chould not figure out on how to do it with when there is more then one line to take.

    For example my text includes this lines :

    PHP Code:
       Location  Utah
       Season    
    Pre-Rut
       Time      
    04/13/12 19:42:18
       Duration  
    15 minutes
       Game type 
    Best_Trophy
       Difficulty
    Expert
       Result    
    Game_has_a_winner!
       
    Players   2
          1. 
    "Brian" is a Winner!
             
    Trophy(ies) : 4
             Score       
    428.747
             Best Trophy 
    Male Whitetail 
                Points   
    Total (428.747) = Animal score (150.010)
                
    Distance 246.07 meters
          2. 
    "stefano sorsoli 
    Now I need to have :
    Location : + Time : + Animal score in one line on my textbox .

    I used this :

    Code:
    List<string> data = new List<string>();
        using (StreamReader sr = new StreamReader(textBox1.Text + @"\Game\Game.LOG"))   
        {
            while (sr.Peek() > -1)
            {
                string ln = sr.ReadLine();
                if (ln.Contains("Location :")) + ("   Time :")) + ("   Animal score  ")
               {
                    string values = (from Match m in Regex.Matches(ln, @"""(.*?)""", RegexOptions.IgnoreCase)
                                 select m.Value).ToArray()[0];
                textBox3.Text = ("All Time Winner is : " + values.Replace((char)34, '\n'));
    }
    }
    }
    but this doesnt work.
    Last edited by deve; Apr 16th, 2012 at 09:56 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width