0
I need to verify that the contents of a file are in alphabetical order, but I want you to display only one error check message. With the code I am using, it displays the errors according to the amount of items.
Dim local_arquivo As String
Dim c As Char
Dim split As String()
Dim ordemalf As String
DataGridTodos.Rows.Clear()
local_arquivo = TextBox.Text
Dim leitura As New System.IO.StreamReader(local_arquivo, System.Text.Encoding.Default)
c = ";"
While leitura.Peek() <> -1
split = leitura.ReadLine().Split(c)
ordemalf = split(1)
Dim i As Integer
For i = 0 To split(1).Length - 1
If ordemalf(0) > "A" Then
MessageBox.Show("Arquivo incorreto!", "VESCPF", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
DataGridTodos.Rows.Add(split)
End If
Next
End While
What am I doing wrong?
And to stop the loop at the first occurrence?
– Catharina Lopes
I edited the answer!
– Lucas Oliveira