1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Private Sub ok_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click
Dim con As SqlConnection = New SqlConnection("data source=LALA;initial catalog=Mome;User ID=sa; password=thek")
Dim drv As DataRowView = CType(LocatairesDataGridView.CurrentRow.DataBoundItem, DataRowView)
'cb1 c'est le comobox1
Dim cb1 As New ComboBox
Dim ds As New DataSet
'val la valeur récupérer sur le comobox
Dim val As String = cb.Text
Dim vale2 As Object = drv("Nom")
Dim vale As Object = drv("IdLocat")
Dim vale1 As Object = drv("Adresse")
con.Open()
cb1.DataSource = ds.Tables("Locataires")
cb1.DisplayMember = "Nom"
con.Close()
'Dim t() As String = cb1.Items
For i As Integer = 0 To cb1.Items.Count - 1
If val = cb1.Items(i) Then
LB.Text = val
LB1.Text = vale1
Else
MsgBox("le Nom n'existe pas!!", MsgBoxStyle.OkOnly)
End If
Next |
Partager