I would use the ItemData of the ComboBox Properties to set the ID for each piece of data and then call it in your code from there. In your code you can call the data to be displayed by number or actual object name. I'm not sure but the code might look something like this:
Private Sub Combo1_Click
MSFlexGrid.Data1 = First Data piece
MSFlexGrid.Data2 = Second Data piece
and so on
hi,
I need to let user select an option from combo or lit box while working with MsFlexGrid. when uer select specific cell he must be presented with combo/list box where he can select his option
Unfortunately, the FlexGrid does not allow for direct editing. But there is a workaround. There are several steps for this.
1) Create a combobox on the form in the same container as the FlexGrid. Set the .Visible property of the combobox to false. Insure that the combobox is in front of the grid.
2) Then drop in the following code. What happens is that the user clicks on a cell, the value of the cell is copied into the combobox, the combobox is positioned on top of the cell, made visible, and given focus. In the lost focus, the selected value is copied from the combobox backup into the cell, and the combobox is made invisible again.
Private Sub grdGrid_Click()
Select Case grdGrid.Col
Case 1, 3, 4 ' <List of Columns that Use Text Boxes>
ActivateTextBox
Case 2, 5, 6 ' <List of Columns that Need Combo Box>
ActivateComboBox
End Select
As you can see, you can also use the same technique with text boxes over those cells which would require a text box for updating.
Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
I have copied and pasted the code that you have provided several months ago. The problem I am having tho is that the combo box continues to display behind the FlexGrid.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.