Bonjour,

Je ne sais pas si je suis sur le bon forum, donc n'hésitez pas a me reprendre. Mon problème: j'ai un fichier excess de 12 colonnes et 80 lignes, j'ai fais une form visual studio en vb.net a laquelle j'ai associé ma base de donnée en mdb pour eviter les pbs de ole12 etc...
jusqu'a la tout va bien, j'affiche une datagridview dans laquelle je voudrais récupéré des datas en fct de 2 combobox... et la ça coince car la seule valeur que je récupère,c'est celle de la première ligne, la colonne est bonne mais pas la ligne ... je mets mon code pour vous donner une idée.
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Public Class Form1
    Dim OD_inches As String
    Dim weight As String
    Dim sql As String
    Dim vol_int As String
    Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
 
    End Sub
 
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: cette ligne de code charge les données dans la table 'CsgDataSet1.Csg_datas'. Vous pouvez la déplacer ou la supprimer selon les besoins.
        Me.Csg_datasTableAdapter.Fill(Me.CsgDataSet1.Csg_datas)
 
    End Sub
 
    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
 
        If ComboBox1.Text = "4 1/2" Then
            ComboBox2.Items.AddRange(New Object() {"9.5", "10.5", "11.6", "13.5", "15.1", "16.9", "17.7", "18.8"})
        End If
 
        If ComboBox1.Text = "5" Then
            ComboBox2.Items.AddRange(New Object() {"11.5", "13", "15", "18", "10.8"})
        End If
 
        If ComboBox1.Text = "5 1/2" Then
            ComboBox2.Items.AddRange(New Object() {"14", "15.5", "17", "20", "23"})
        End If
 
        If ComboBox1.Text = "6 5/8" Then
            ComboBox2.Items.AddRange(New Object() {"20", "24", "28", "32"})
        End If
 
        If ComboBox1.Text = "7" Then
            ComboBox2.Items.AddRange(New Object() {"17", "20", "23", "26", "29", "32", "35", "38", "41", "44"})
        End If
 
        If ComboBox1.Text = "7 5/8" Then
            ComboBox2.Items.AddRange(New Object() {"24", "26.4", "29.7", "33.7", "39", "55.3"})
        End If
 
        If ComboBox1.Text = "8 5/8" Then
            ComboBox2.Items.AddRange(New Object() {"24", "28", "32", "36", "40", "44", "49"})
        End If
 
        If ComboBox1.Text = "9 5/8" Then
            ComboBox2.Items.AddRange(New Object() {"32.3", "36", "40", "43.5", "47", "53.5", "58.4", "61.1", "71.8"})
        End If
 
        If ComboBox1.Text = "10 3/4" Then
            ComboBox2.Items.AddRange(New Object() {"32.75", "40.5", "45.5", "51", "55.5", "60.7", "65.7"})
        End If
 
        If ComboBox1.Text = "11 3/4" Then
            ComboBox2.Items.AddRange(New Object() {"42", "47", "54", "60"})
        End If
 
        If ComboBox1.Text = "13 3/8" Then
            ComboBox2.Items.AddRange(New Object() {"48", "54.5", "61", "68", "72"})
        End If
 
        If ComboBox1.Text = "16" Then
            ComboBox2.Items.AddRange(New Object() {"65", "75", "84"})
        End If
 
        If ComboBox1.Text = "18 5/8" Then
            ComboBox2.Items.AddRange(New Object() {"87.5"})
        End If
 
        If ComboBox1.Text = "20" Then
            ComboBox2.Items.AddRange(New Object() {"94", "106.5", "133"})
        End If
 
        If ComboBox1.Text = "24" Then
            ComboBox2.Items.AddRange(New Object() {"87,5"})
        End If
 
 
 
    End Sub
 
 
 
    Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
 
        TextBox1.Text = ComboBox1.Text
        TextBox2.Text = ComboBox2.Text
        OD_inches = TextBox1.Text
        weight = TextBox2.Text
 
 
        sql = "SELECT vol_int FROM Csg_datas WHERE OD_inches =  '" & OD_inches & "'   and weight =  " & weight & ""
 
        vol_int = DataGridView1.Rows(vol_int).Cells(10).Value.ToString
 
        TextBox3.Text = vol_int
    End Sub
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Application.Exit()
 
    End Sub
End Class