I have a combo box with a list of my customers, when a user selects a customer i
have the customer code populate a label called LBcustomer.
here is how i populate my combo box
Dim connString As String = "Data Source=" & ServerV & ";Initial Catalog=" & databaseV & ";Persist Security Info=True;User ID=" & usernameV & ";Password=" & passwordV & ""
Dim conn As New SqlConnection(connString)
Dim strSQL As String = "Select Customer,Name From ArCustomer where Salesperson=" & Me.LBASM.Text & ""
Dim DA As New SqlDataAdapter(strSQL, conn)
Dim dt As New DataTable 'Populate the datatable
DA.Fill(dt) 'Bind the stock datatable to the combobox
With CBOCustomer
.DropDownStyle = ComboBoxStyle.DropDownList
.DataSource = dt
.DisplayMember = "Name"
.ValueMember = "Customer"
End With
i also have
Private Sub CBOCustomer_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CBOCustomer.SelectedIndexChanged
Me.LBCustomer.Text = Me.CBOCustomer.SelectedValue.ToString
End Sub
this populate the label, but when first run, the label says
"System.Data.datarowview"
(see the pic below)
when i use the combo and select a customer it then populates the customer code in the
label. it only does this the first time the code is run. how can i make this label blank or input a number I.E "0"?