ComboBox in a cell in a list?

L

Lars Netzel

I have, in earlier projects, had som serious problems with ComboBoxColumns
in a datagrid. And now I'm in a projects where I needs sometthing like that
again.. but I really do not want to work with Datagrid in Windows.Form cause
they are buggy and ComboBoxes are not easy to work with there (especially
not when you need Multi Columns in the Comboboxes as well).

Is there a better way or a better object to use when doing this sort of
stuff?

Could one place ComboBoxes as a column in ListViews?

best regards
/Lars netzel
 
C

Cor Ligthert [MVP]

Lars,

It is your opinion however I find it strange that you want to take the
combobox and not the datagrid.

Just my thought,

Cor
 
L

Lars Netzel

Well actually... I think I fixed it..

In the DataGridComboColumnStyle Class I added this

Public Event ColumnComboBoxSelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

....and then in the Event that has the SetColumnValueAtRow (which is ComboChanged) I Raised that event..

...and then, in the Form Class, when setting the properties for this style and adding it to the DataGridTableStyle I added a handler

'COMBOBOX

Dim statestyle As New DataGridComboColumnStyle(ds.Tables("States"), "State", "State")

statestyle.MappingName = "State"

statestyle.HeaderText = "States"

ts.GridColumnStyles.Add(statestyle)

AddHandler countrystyle.ColumnComboBoxSelectedIndexChanged, AddressOf ColumnComboBox_SelectedIndexChanged

And then

Public Sub ColumnComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

MsgBox(CType(sender, DataGridCombo).SelectedValue)

End Sub

Which Worked fine:) Then I can take that Value and search for a Row in the ComboBox Source and then grab whatever mpre fields I need and add to the cells on the same row in the grid

This wouldn't give me any problems later on or?

/Lars Netzel
 
L

Lars Netzel

Hi

If I found a bug and I cant get around it.. I don't always have time to
spend trying to get around it. I'm can't debit my customers for stuff like
that.

/Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top