We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add a new empty row in bind combo

Thread ID:





50940 Oct 24,2006 08:16 AM UTC Oct 25,2006 05:49 AM UTC WinForms 1
Tags: FAQ
Asked On October 24, 2006 08:16 AM UTC

Hi; I have a ComboBox (VS 2003) linked to DataSet; but I need add a new empty row (on the top) for select nothing.

How can I make this?


Replied On October 25, 2006 05:49 AM UTC

OK, I found the answer. It's this (if someone is insteresting):

Private Sub FillComboAgentes()
Dim list As New DataTable
Dim DRow As DataRow
Dim X As Int16 = 1

list.Columns.Add(New DataColumn("Nombre", GetType(String)))
list.Columns.Add(New DataColumn("AgenteID", GetType(Integer)))
list.Rows(0)(0) = "--- Ninguno ---" '
list.Rows(0)(1) = DBNull.Value

For Each DRow In TargeDS.Agentes
list.Rows(X)(0) = DRow("Nombre") & " " & DRow("Apellidos")
list.Rows(X)(1) = DRow("AgenteID")
X += 1

C_Agentes.DataSource = list
C_Agentes.DisplayMember = "Nombre"
C_Agentes.ValueMember = "AgenteID"
End Sub


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon