I need to check if the contents of a file are in alphabetical order, but I want it to display only one message with the error check. With the code I'm using, it displays 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?