Error MCCB

1 posts, 0 answers
  1. Hengky
    Hengky avatar
    18 posts
    Member since:
    Sep 2015

    Posted 17 Feb Link to this post

    Hello All...

    I need help about MCCB...

    Why the data always change to blank after i click new button or edit button 

    hope attached picture help to explain the problem 

     Here the code i write on Form_load 

    ds = New DataSet("Daftar")
     
            Tblanggota = ds.Tables.Add("Anggota")
            With Tblanggota
                .Columns.Add("KODE", GetType(String))
                .Columns.Add("NAMA", GetType(String))
            End With
            'fill TblAnggota
     
            Using conn As New OleDbConnection(str)
                conn.Open()
                Using cmd = conn.CreateCommand()
                    'mengisikan data Anggota.
                    Dim query = <sql>
                                     SELECT KodeAnggota as KODE, NamaAnggota as NAMA FROM MstAnggota ORDER BY KodeAnggota
                                 </sql>.Value()
                    cmd.CommandText = query
                    Dim adapter = New OleDbDataAdapter(cmd)
                    adapter.SelectCommand = cmd
                    Tblanggota.Rows.Add(New Object() {"", ""})
                    adapter.Fill(Tblanggota)
                End Using
                With CmbAnggota
                    .DataSource = Tblanggota
                    '.SelectedValue = ""
                    .AutoSizeDropDownToBestFit = True
                    .BestFitColumns()
                    .AutoFilter = True
                    .DisplayMember = "KODE"
                    .ValueMember = "KODE"
                    .Text = ""
                    TxtNamaAnggota.Text = ""
     
                    'Dim filter As New FilterDescriptor()
                    'filter.PropertyName = Me.CmbAnggota.DisplayMember
                    'filter.[Operator] = FilterOperator.Contains
                    'Me.CmbAnggota.EditorControl.MasterTemplate.FilterDescriptors.Add(filter)
                    'CmbAnggota.MultiColumnComboBoxElement.EditorControl.EnableCustomFiltering = True
     
                    'AddHandler CmbAnggota.MultiColumnComboBoxElement.EditorControl.CustomFiltering, AddressOf CmbAnggota_CustomFiltering
                    'AddHandler CmbAnggota.KeyDown, AddressOf CmbAnggota_KeyDown
     
     
                End With
     
                conn.Close()
            End Using
     
            TxtNamaAnggota.DataBindings.Add("Text", Tblanggota, "NAMA")

    I have tried to move the code on button_click event. but the i got the same result.

     

    Thanks before

Back to Top