Bonjour,
J'ai un programme qui permet de filtrer avec un combobox un datagriview remplis avec une table access.
Le probleme c'est qu'en filtrant la combobox pour ne pas avoir de doublons, il fait la distinction entre majuscule et minuscule
Par exemple, j'ai les clients
AA
aa
BB
bb
dans la combobox je vais avoir : aa et bb mais en selectionnant aa je ne vais pas avoir le client AA
Je sais pas si c'est tres clair, je met le code pour voir si qq trouve une idee
merci d'avance pour vos reponses
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Dim ChaineConnexion As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source = Database2.accdb" Dim DtSet As New DataSet() Dim UneTable2 As New DataTable Dim UneTable5 As New DataTable Dim cn2 As New OleDbDataAdapter("select distinct CustomerName from tblToolRequisition Order by CustomerName asc", ChaineConnexion) ' tblCustomer Dim cn5 As New OleDbDataAdapter("Select * from tblToolRequisition", ChaineConnexion) cn2.Fill(UneTable2) cn5.Fill(UneTable5) DtSet.Tables.Add(UneTable2) DtSet.Tables(1).TableName = "tblCustomer" DtSet.Tables(4).TableName = "tblToolRequisition" DataGridView1.DataSource = DtSet.Tables("tblToolRequisition") ComboBox2.DataSource = DtSet.Tables("tblCustomer") ComboBox2.DisplayMember = "CustomerName" End Sub Private Sub LesComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged, ComboBox2.SelectedIndexChanged, ComboBox3.SelectedIndexChanged Dim IndexColonne As Integer Dim IndexLigne As Integer DataGridView1.ClearSelection() Select Case sender.name Case "ComboBox2" IndexColonne = 3 End Select For IndexLigne = 0 To DataGridView1.Rows.Count - 1 Try If DataGridView1.Item(IndexColonne, IndexLigne).Value = sender.Text Then DataGridView1.Rows(IndexLigne).Selected = True End If Catch End Try Next End Sub
Partager