Hi guys,
I am experiencing a problem with a variable I declare. If I pass on a real value that the variable might contain code works ok , but if I leave the code to get the variable as decalred it doesn`t.
What my code is doing is checking if a string variable exists in a string array. Here is the code:
Dim frow As String = Mid(RichTextBox1.Text, 1, 800)
Dim ftreaty As String = Mid(frow, 96, 9)
Dim StrArray() As String = {"AB3VLMY2", "AUMN56HG"}
Dim FindString As String = ftreaty
For Each Str As String In StrArray
If Str.Contains(FindString) Then
RichTextBox2.Text &= frow & Environment.NewLine
End If
Next
Dim fs2 As New FileStream("C:\File.txt", FileMode.Create, FileAccess.Write)
Dim ss As New StreamWriter(fs2)
ss.WriteLine(RichTextBox2.Text)
ss.Close()
Please please tell me where I am wrong :P
When instead of
Dim FindString As String = ftreaty
I give a real value like
Dim FindString As String = "AUMN56HG" for example
it does the check and writes the row in the new file.
when however the code is like above it writes an empty row having that in the original file the value in the first row it should pick up is in the array and it should write the row in the new file. It doesn`t though it simply writes an empty row.
Thanks in advance