We help IT Professionals succeed at work.

ADD BLANK DATA TO A BINDED COMBOBOX

emi_sastra
emi_sastra asked
on
Hi All,

I have below code to fill combo.

How could I add blank row to the combobox ?

Thank you.
Private Sub Fill_ComboBox()

        blnFillCombo = True

        Dim strJoin As String = " INNER JOIN TMJENISKARYAWAN AS B"
        strJoin &= " ON A.KodeJenis = B.KodeJenis"

        Dim strCriteria As String = "B.Professional = '" & ERV_Global.LBL_YES & "'"

        dtTable = ERV_Global.Open_DataTable_Join_Table("TMTIPEKARYAWAN AS A", "A.Keterangan, A.KodeTipe", strJoin, strCriteria, "A.Keterangan", strConnectionServ)

        With cboKodeTipeKaryawan
            .DataSource = dtTable
            .DisplayMember = "Keterangan"
            .ValueMember = "KodeTipe"
        End With

        cboKodeTipeKaryawan.SelectedIndex = -1

        blnFillCombo = False

    End Sub

Open in new window

Comment
Watch Question

Add a "blank" row to the datatable....

    dtTable.Rows.InsertAt(dtTable.NewRow, 0)

Wayne

Author

Commented:
Hi Wayne,

The added value is null.

How to add it with blank (space).

Thank you.
Dim dr As DataRow = dtTable.NewRow()
dr("Keterangan") = ""
dtTable.Rows.InsertAt(dr, 0)

Author

Commented:
Ok.

Thank you very much for your help.