scgilbert1
New Member
- Joined
- Nov 15, 2011
- Messages
- 15
Hello,
I have a userform with a multi-column listbox populated from a 2D array. The purpose of the userform is to allow the user to see and edit basic information for a list of clients using a combination of textboxes and checkboxes. The listbox is used to select a single client to view the data inputs for that client. When a client is selected, a group of textboxes and checkboxes are populated based on the data in the list (originally from the array). If the user makes any changes to the client data as tracked by the userform, it will ask if they want to save. If they say yes, the original data array is edited and the listbox should be updated to reflect the edits.
To populate the listbox, I have a single procedure that populates the list from the array data. I am using this procedure in the when the userform is initialized and when updates are made by the user.
However, I am running into an odd issue. When a user edits the data and I repopulate the listbox, the listbox itself doesn't initially reflect the changes and still reflects the original data. However, when I select the edited client from the list, the edited data shows correctly in the associated text boxes and check boxes as if the listbox had been changed but now it no longer matches. Every weirder, if I close the userform and reinitialize it, the listbox will then show the changes.
My current method to update the listbox is as follows.
colWidths = "15,60,60,20,20,20,20,20,50,50"
With Me.LB_Names
'.Clear
.List = clientList
.ColumnCount = UBound(clientList, 2)
.ColumnWidths = colWidths
End With
I commented out the ".clear"command because it would result in the listbox not being populated at all even though the backend data was updated properly. The clientList variable is an 2D Variant/Variant Array.
Thank you!
I have a userform with a multi-column listbox populated from a 2D array. The purpose of the userform is to allow the user to see and edit basic information for a list of clients using a combination of textboxes and checkboxes. The listbox is used to select a single client to view the data inputs for that client. When a client is selected, a group of textboxes and checkboxes are populated based on the data in the list (originally from the array). If the user makes any changes to the client data as tracked by the userform, it will ask if they want to save. If they say yes, the original data array is edited and the listbox should be updated to reflect the edits.
To populate the listbox, I have a single procedure that populates the list from the array data. I am using this procedure in the when the userform is initialized and when updates are made by the user.
However, I am running into an odd issue. When a user edits the data and I repopulate the listbox, the listbox itself doesn't initially reflect the changes and still reflects the original data. However, when I select the edited client from the list, the edited data shows correctly in the associated text boxes and check boxes as if the listbox had been changed but now it no longer matches. Every weirder, if I close the userform and reinitialize it, the listbox will then show the changes.
My current method to update the listbox is as follows.
colWidths = "15,60,60,20,20,20,20,20,50,50"
With Me.LB_Names
'.Clear
.List = clientList
.ColumnCount = UBound(clientList, 2)
.ColumnWidths = colWidths
End With
I commented out the ".clear"command because it would result in the listbox not being populated at all even though the backend data was updated properly. The clientList variable is an 2D Variant/Variant Array.
Thank you!