Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/01/2011, 13:34
guillebomtrasmiti
 
Fecha de Ingreso: noviembre-2010
Ubicación: madrid
Mensajes: 478
Antigüedad: 13 años, 5 meses
Puntos: 5
Respuesta: Seleccion en combobox

mando más código...pero no me da salido

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim codigo As Integer

Try
codigo = Convert.ToInt32(ComboBox1.SelectedValue)
Catch ex As InvalidCastException

Exit Sub

End Try

Dim a As Integer = New Integer

Dim adaptador As New SqlDataAdapter("Select Producto From Productos Where NFamilia= " & codigo, conexion)

'aquí cargo el dataset con la tabla deseada y lo cargo con fill
midataset.Tables("Productos").Clear()
adaptador.Fill(midataset.Tables("Productos"))
If DgLista.DataMember = "" Then
DgLista.DataMember = "Productos"

End If
End Sub
Public Sub cargargrid()

conexion.ConnectionString = "Data Source=.\SQLEXPRESS11;AttachDbFilename=C:\VISUAL\T pvVigoSe\TpvVigo\Tpv.mdf;" & _
"Integrated Security=True;" & _
"Connect Timeout=30;" & _
"User Instance=True"


'aquí cargo la estética del datagrid
DgLista.DefaultCellStyle.SelectionBackColor = Color.Gold
DgLista.AlternatingRowsDefaultCellStyle.BackColor = Color.Khaki
DgLista.DefaultCellStyle.BackColor = Color.Beige
DgLista.RowTemplate.Height = 20
DgLista.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells

'aquí cargo el datasource y el datamenber del datagrid
DgLista.DataSource = midataset.Tables("Productos")

End Sub
End Class