I am back with a new question.
I am working on a Listview Control.
I need to show groups in it and am failing to understand which part of my code is incorrect :
'Clear Listview ForumLSTView.Items.Clear() ForumLSTView.Groups.Clear() Dim itm As ListViewItem Dim GRP As New ListViewGroup Dim cnt As Long ForumLSTView.BeginUpdate() SqlComm1 = New OleDb.OleDbCommand 'proceed to Make Groups...find out what we need SqlComm = CON.CreateCommand SqlComm.CommandText = "SELECT DISTINCT MNTH from LOUNGE_TALK" Rs = SqlComm.ExecuteReader While Rs.Read = True ForumLSTView.Groups.Add(New ListViewGroup(Rs(0), HorizontalAlignment.Left)) End While Rs.Close() 'Now, fill the listview control with all items from the database 'also assign items to the ForumLSTView.Groups SqlComm = CON.CreateCommand SqlComm.CommandText = "SELECT * from LOUNGE_TALK order By POSTEDAT DESC" Rs = SqlComm.ExecuteReader While Rs.Read = True cnt = 0 itm = ForumLSTView.Items.Add(CDate(Rs("PostedAt"))) itm.SubItems.Add(Rs("PostTopic")) itm.SubItems.Add(Rs("PostedByName")) itm.SubItems.Add(Rs("ProdList")) itm.SubItems.Add(Rs("ProdLine")) 'Get all count of all replies to this post SqlComm1 = CON.CreateCommand SqlComm1.CommandText = "SELECT * from LOUNGE_TALK where InReplyto='" & Rs("POSTID") & "'" Rs1 = SqlComm1.ExecuteReader While Rs1.Read = True cnt = cnt + 1 End While Rs1.Close() itm.SubItems.Add(cnt) 'Now make a group For i = 0 To ForumLSTView.Groups.Count - 1 If Rs("MNTH") = ForumLSTView.Groups(i).ToString Then itm.Group = ForumLSTView.Groups(i) End If Next i itm.Group.Header = Rs("MNTH") End While Rs.Close() ForumLSTView.EndUpdate()
I find nothing wrong as far as the code is concerned, however i was wondering whether there is any setting for the control itself.
A snapshot of the database and field types is attached....
Number of downloads: 574