Hi, after problems with using checkedlistboxes and the rest. I decided to take an easier route and use a listbox which i have populated from a database. It contains text with values assigned to it. i also have a DGV with 4 columns. The column i wish to sort by contains integers only.
I am just wondering how i can sort the DGV by passing a value from the listbox.. here is my code:
Private Sub lstCat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstCat.SelectedIndexChanged
'MsgBox("you selected " + lstCat.SelectedValue.ToString)
Dim i As Integer
i = lstCat.SelectedValue
'DGVShops.Sort(DGVShops.Columns(1), System.ComponentModel.ListSortDirection.Ascending)
End Sub
The msgbox was for testing the values are correct.
i is supposed to equal the value of selected index (which is fortunately the same as the CatID will be i want to sort by)
The last line just sorts it in ascending, but i would like to sort the column by whatever given value (2,3,4, etc)