Hi All
I have a piece of code in my application that is giving me a funny result. I am reading a text file and based on it's first word on the line I have a bunch of IF statements that then assign the value to a variable.
The problem is that not all the if statements are being met, well they are but that's what's weird.
Here's my code and I'll explain
You will notice that half way down the IF statements there is one block that is commented out, if I leave this commented out all values are assigned, if I uncomment the block the last two variables are not assigned.
Can someone shed any light as to why this is happening ?
Thanks in advance
I have a piece of code in my application that is giving me a funny result. I am reading a text file and based on it's first word on the line I have a bunch of IF statements that then assign the value to a variable.
The problem is that not all the if statements are being met, well they are but that's what's weird.
Here's my code and I'll explain
Code:
If File.Exists(varIni) Then Dim readFile As System.IO.TextReader = New StreamReader(varIni) Dim line As String While readFile.Peek > -1 line = readFile.ReadLine() If line.Substring(0, 9) = "CompName=" Then varCompName = line.Substring(9, line.Length - 9) TextBox5.Text = varCompName End If If line.Substring(0, 12) = "PhoneNumber=" Then varPhoneNum = line.Substring(12, line.Length - 12) TextBox6.Text = varPhoneNum End If If line.Substring(0, 11) = "WebAddress=" Then varWebAdd = line.Substring(11, line.Length - 11) TextBox7.Text = varWebAdd End If 'If line.Substring(0, 13) = "EmailAddress=" Then ' varMailAdd = line.Substring(13, line.Length - 13) ' TextBox8.Text = varMailAdd 'End If If line.Substring(0, 11) = "EmailLogin=" Then varMailLog = line.Substring(11, line.Length - 11) TextBox9.Text = varMailLog End If If line.Substring(0, 10) = "EmailPass=" Then varMailPass = line.Substring(10, line.Length - 10) TextBox10.Text = varMailPass End If If line.Substring(0, 11) = "HourlyRate=" Then varHourly = line.Substring(11, line.Length - 11) TextBox11.Text = varHourly End If If line.Substring(0, 9) = "MealRate=" Then varMeal = line.Substring(9, line.Length - 9) TextBox12.Text = varMeal End If End While readFile.Close() readFile = Nothing Else MessageBox.Show("You will need to configure your application, please go to the Configuration tab and fill in the details for your business", "xlcr IT Solutions", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If
Can someone shed any light as to why this is happening ?
Thanks in advance
Comment