Web Development

General discussion


combobox inside DBgrid

By im_a_beginner ·
could you please teach me how to put a combobox inside DBgrid.. i have a table "profiles" the fields are <lname,fname,mname>

if we bind profiles in DBgrid we have 3 columns and many rows... how can i put the combobox in column 1 which is lname... when i click the combobox inside the DBgrid the combobox list shows all the lname records...
i have a link to planet-source-code.com but i cant find it..
please help i cant proceed to another if i cant finish about combobox... thank you

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by im_a_beginner In reply to combobox inside DBgrid

Point value changed by question poster.

Collapse -

by msbeal2 In reply to combobox inside DBgrid

I wrestled with the same problem about a year ago. I solved the problem in my program's datagrid. I seem to recall that I found a paper on the net which showed me how to do it. I am sorry but I do not remember where I got the paper or where I put the paper. I remember it wasn't real easy to find. Nor was the procedure all that snappy to implement. It requires custom derived classes from combobox. I will outline it here but if you would like to see the code shoot me an email and I will send you the actual vb files involved. msbeal@mchsi.com The good news is that most of it is cut and paste.

In general: First, you create a new class derived from combobox to tweak some of the event notifications.

Public Class NoKeyUpCombo
Inherits ComboBox
'code omitted here.

End Class

Then you create a new custom class which inherits from the built in DataBoxTextBoxColumn in which you will instantiate the first class ,the NoKeyUpCombo, in the constructor.

Public Class DataGridComboBoxColumn
Inherits DataGridTextBoxColumn
'Code omitted (basically you will override all the built in functions and events.)
End Class

Then in the initialization for the grid's TableStyleDataGrid (an object which is well documented in Help files) you will create and add this custom combo class right into to the
GridColumnStyles collection of the TableStyleDataGrid.

Dim ComboTextCol As New DataGridTextBoxCombo.DataGridComboBoxColumn()
'..code omitted due to space

The key is the ComboTextCol object mentioned above which is the resultant object created from these two new custom classes.

Again, I apologize for the brevity but the code is too long to paste here.

Related Discussions

Related Forums