Cambialo así :
Código vb:
Ver originalPrivate Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As New DataSet
Dim conexion As New MySqlConnection("Server=localhost; Database=controlsmi; user=root; password=Smi2012") 'cadena conexion
Dim SelectedValue As String = "SELECT ID_producto, nombre FROM producto" 'consulta a la tabla
Dim comando As New MySqlCommand(SelectedValue, conexion)
Dim adap As New MySqlDataAdapter(comando)
conexion.Open()
adap.Fill(ds,"Productos")
conexion.Close()
cboproducto.DataSource = ds.Tables(0)
cboproducto.DisplayMember = "nombre"
cboproducto.ValueMember = "ID_producto"
cboproducto.SelectedIndex = -1
Para el evento :
Código vb:
Ver originalDim ds As New DataSet
Dim conexion As New MySqlConnection("Server=localhost; Database=controlsmi; user=root; password=Smi2012") 'cadena conexion
Dim SelectedValue As String = "SELECT serial FROM producto where Id_producto=" + cboproducto.SelectedValue.ToString 'consulta a la tabla"
Dim comando As New MySqlCommand(SelectedValue, conexion)
Dim adap As New MySqlDataAdapter(comando)
conexion.Open()
adap.Fill(ds,"Serial")
conexion.Close()
cboserial.DataSource = ds.Tables(0)
cboserial.DisplayMember = "serial"
cboserial.ValueMember = "serial"
Prueba y comentas. Saludos!
.