Hi there folks, I have a listbox called Studentlist. It has 4 different items put there in an array like this.
The listbox is set up like this..
Set Students = CreateObject("ADODB.Recordset")
Students.Fields.Append "Name", 202, 4000 '202=adVarWChar
Students.Fields.Append "Points", 3 '3=adInteger
Students.Fields.Append "Avatar", 202, 4000 '202=adVarWChar
Students.Fields.Append "Birthday", 202, 4000 '202=adVarWChar
And items are put into the listbox like this...
Now the reason why we do that is so we can organize the student names alphabetically, and keep track of whos birthday, points, avatar are whoms, so when the names are reordered, the other things stay with the student.
Now my problem is I am trying to copy the items back into their original textboxes and label captions, these are the same ones they came from, so again they stay in order with the student.
I can do it by going StudentNameTXT(0).text = Students!Name, but it will only give me the last item entered at the bottom of the list, I would like to have it go to the top.
Is there some trick I am missing here? Thanks!!!!
VB Code:
Option Explicit Private Students As Object Students.AddNew Array("Name", "Points", "Avatar", "Birthday"), Array(EditRosterV3.StudentNameTXT(0).Text, EditRosterV3.PointCountLBL(0).Caption, EditRosterV3.StudentAvatarPathTXT(0).Text, EditRosterV3.StudentBdayLBL(0).Caption)
The listbox is set up like this..
Set Students = CreateObject("ADODB.Recordset")
Students.Fields.Append "Name", 202, 4000 '202=adVarWChar
Students.Fields.Append "Points", 3 '3=adInteger
Students.Fields.Append "Avatar", 202, 4000 '202=adVarWChar
Students.Fields.Append "Birthday", 202, 4000 '202=adVarWChar
And items are put into the listbox like this...
VB Code:
Private Sub FillList(Optional ByVal OrderByClause As String) Dim i As Long Students.Sort = OrderByClause StudentList.Clear For i = 1 To Students.RecordCount Students.AbsolutePosition = i StudentList.AddItem Students!Points & vbTab & Students!Name & vbTab & Students!Birthday & vbTab & Students!Avatar Next i End Sub
Now the reason why we do that is so we can organize the student names alphabetically, and keep track of whos birthday, points, avatar are whoms, so when the names are reordered, the other things stay with the student.
Now my problem is I am trying to copy the items back into their original textboxes and label captions, these are the same ones they came from, so again they stay in order with the student.
I can do it by going StudentNameTXT(0).text = Students!Name, but it will only give me the last item entered at the bottom of the list, I would like to have it go to the top.
Is there some trick I am missing here? Thanks!!!!