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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| Public Class Form1
Private Sub ClientsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClientsBindingNavigatorSaveItem.Click
Me.Validate()
Me.ClientsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(SARIADataSet)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: cette ligne de code charge les données dans la table 'SARIADataSet.Clients'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
Me.ClientsTableAdapter.Fill(SARIADataSet.Clients)
End Sub
Private Sub ClientsDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles ClientsDataGridView.CellContentClick
Try
'Remplissage du DataGridView
Dim DS As DataSet = New DataSet
Dim mondA As SqlClient.SqlDataAdapter
Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection(connectString)
Dim MaRequete As String = "select Nom, NDI, Ville from Clients where NDI='" & Me.TextBox1.Text & "'"
con.Open()
mondA = New SqlClient.SqlDataAdapter()
mondA.Fill(DS, "")
ClientsDataGridView.DataSource = DS.Tables(0).DefaultView
con.Close()
Catch
MsgBox(Err.Description)
Finally
End Try
End Sub
Private Function connectString() As String
Throw New NotImplementedException
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If String.Compare(TextBox1.Text, "") = 0 Then
' Pas besoin de filtre, on affiche la table
SARIADataSet.Clients.DefaultView.RowFilter = ""
Else
' Il existe quelque chose dans la textBox on applique le filtre
SARIADataSet.Clients.DefaultView.RowFilter = "NDI LIKE '%" & TextBox1.Text & "%'"
End If
End Sub
End Class |