I'm working on a simple updater program that gets text from a file called version.dv that will always have a number in the form of 1.00, 1.15, 2.00
I can't figure out how to get it to read the file and save the text to a string though. Here's what I have, but I have no idea where to go. If anyone has ideas, I would be in your debt.

 private void button2_Click(object sender, EventArgs e)
        {
            //Open Version.DV
            //Check number (1.00)
            //If number is less, update. If not, switch to play now.

               using (StreamReader sr = new StreamReader("c:\\version.DV")) 
            {
                String line;
                // Read and display lines from the file until the end of 
                // the file is reached.
                while ((line = sr.ReadLine()) != null) 
                {
                    Console.WriteLine(line);
                }
                double linevalue = Convert.ToDouble(line);
                if (linevalue > 3.00)
                {
                    Application.Exit();
                }
                else
                {
                    mainbut.Text = "Play!";
                }
            }
        }

You should have to use System.Text.StringBuilder.

StringBuilder sb=new StringBuilder();
while ((line = sr.ReadLine()) != null) 
    {
           sb.Append(line);
     }

Or I would use

sb.AppendLine(line);

This will put lines into each line (same as in file).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.