bob bob

bob bob

  • NA
  • 7
  • 0

Parse Values in C# Compact Framework

May 24 2007 11:18 PM

The codes below is part of my project in C# Compact Framework. I want to parse the values of textbox txtIP and txtPort to another form where my socket connection occurs. However, im unable to parse the IP & Port values as it appears empty and produce an error. How can i avoid the error and allow the form to parse values to another?

 

Form1 Codes:

private void LoadSettings()
        {
            string strIp;
            string strPort;
            string path = @"\My Documents\Config.txt";

            if (File.Exists(path))
            {
                using (StreamReader sr = File.OpenText(path))
                {
                    strIp = sr.ReadLine();
                    strPort = sr.ReadLine();
                    txtIP.Text = strIp;
                    txtPort.Text = strPort;
                    sr.Close();
                }
           }

        }


Answers (1)