Search code examples
vb.netc1flexgrid

C1FlexGrid Combobox


I am trying to populate comboboxes in accordance to a value in the flexgrid that is on the same row. However it changes per each row on the flexgrid. I need to populate a combobox based of that row and column. Any help?


Solution

  • As I understood ur question u need to put a combobox inside ur C1FlexGrid and dropdown of ur combobox list contains each row elements. Put this Code where u want to load data into combobox

    Dim dtMap As Specialized.ListDictionary = New Specialized.ListDictionary()
    Dim tmpStyle As CellStyle
    dtMap.Clear()
    For j As Integer = 1 To fgMain.Rows.Count - 1
        For i As Integer = 0 To fgMain.Cols.Count - 1
            dtMap.Add(i , C1FlexGrid1(j ,i))
        Next
    Next
    tmpStyle =C1FlexGrid1.Styles.Add("Name")
    ' integer is data type of data selected into ur combobox. here it's the type of i 
    ' cause i is the key of value in dtMap "every item n ListDictionary dtMap contains key and value"
    'so u just change this i and integer to what u need
    tmpStyle.DataType = GetType(Integer)
    tmpStyle.DataMap = dtMap
    C1FlexGrid1.Cols(2).Style = tmpStyle
    DbReader.Close()
    MyCmd.Dispose()
    

    I hope this will help u