0
I have a listview that shows more or less the following:
ID NOME IDADE
0 Luis 19
1 Julio 33
2 Marcio 27
The problem is that when the ID comes in at 10, the listview starts to put the 11, 12, 13... before the 2, getting something like:
ID NOME IDADE
0 Luis 19
1 Julio 33
11 Claudio 33
12 Felipe 33
2 Marcio 27
I wanted to know how to fix this by making 11, 12, 13... come after 10, and so on.
I recently discovered that the problem lies in the code that reads the files(the information is taken from XML files)
Dim DirDiretorio As DirectoryInfo = New DirectoryInfo(pedidosPath)
Dim oFileInfoCollection() As FileInfo
Dim oFileInfo As FileInfo
Dim i As Integer
oFileInfoCollection = DirDiretorio.GetFiles()
For i = 0 To oFileInfoCollection.Length() - 1
oFileInfo = oFileInfoCollection.GetValue(i)
'Pega os dados do arquivo
Next
With a Messagebox I discovered that he takes the 10, 11, 12, ... before the 2. Some alternative code?
I don’t know much about Vb, but are you treating this column as a whole (if that’s how Vb sees types)? I’ve seen similar problems in other languages, and in the end, the problem was the type of treatment.
– user28595
In vedade, this list is much bigger, there are 7 subitens, this example I put was very crude. The program adds values from XML files, that is, each item (ID, NAME, AGE) is within an XML. I didn’t quite understand your question, but I add the entire item from one file only.
– Gabriel Sarates
I think I was a little confused, I asked you if you treat the column id like
int
(integer numbers). In other languages, this problem was caused because the column ordering was wrong because the program read as string.– user28595
Oh yes, I get it. it’s like String, since I add all the values of all the columns at the same time.
lstPedidos.Items.Add(New ListViewItem(New String() {"", id, nome, telefone,...}))
– Gabriel Sarates
It would be interesting for you to add in the question how you populate the listview with the data. Apparently it’s a problem with data types, as I said.
– user28595
Thanks in advance!!
– Gabriel Sarates