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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
'IHM.vb
Public Class frmIHM
Private cbData As ComboBoxData
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
cbData = New ComboBoxData
' Listing des types de raccordements
infoRacc_typeRacc.DataSource = New BindingSource(cbData.Dic_typeRacco, Nothing)
infoRacc_typeRacc.DisplayMember = "Value"
infoRacc_typeRacc.ValueMember = "Key"
Dim selectedItem As String
selectedItem = infoRacc_typeRacc.SelectedItem.ToString()
selectedItem = selectedItem.Substring(4, selectedItem.Length - 5)
'a virer tout ca
' ComboBox n°2 affiche les prestats aero si ComboBox n°1 = aero
' Prestations pour un branchement Aero Souterrain
'If selectedItem = cbData.Dic_typeRacco.Item("0") Then
' ComboBox1.DataSource = New BindingSource(cbData.Dic_typePrestatsAeroSout, Nothing)
' ComboBox1.DisplayMember = "Value"
' ComboBox1.ValueMember = "Key"
'End If
'' Même principe, cb2 = prestas sout si cb1 = sout
'' Prestations pour un branchement Souterrain
'selectedItem = infoRacc_typeRacc.SelectedItem.ToString()
'selectedItem = selectedItem.Substring(4, selectedItem.Length - 5)
'If selectedItem = cbData.Dic_typeRacco.Item("1") Then
' ComboBox2.DataSource = New BindingSource(cbData.Dic_typePrestatsSout, Nothing)
' ComboBox2.DisplayMember = "Value"
' ComboBox2.ValueMember = "Key"
'End If
End Sub
Private Sub infoRacc_typeRacc_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles infoRacc_typeRacc.SelectedValueChanged
If TypeOf (Me.infoRacc_typeRacc.SelectedValue) Is KeyValuePair(Of Integer, String) Then Return
Dim ndx As Integer = CType(Me.infoRacc_typeRacc.SelectedValue, Integer)
Select Case ndx
Case 0
Me.ComboBox1.DataSource = Nothing
ComboBox1.DataSource = New BindingSource(cbData.Dic_typePrestatsAeroSout, Nothing)
ComboBox1.DisplayMember = "Value"
ComboBox1.ValueMember = "Key"
Case 1
Me.ComboBox2.DataSource = Nothing
ComboBox2.DataSource = New BindingSource(cbData.Dic_typePrestatsSout, Nothing)
ComboBox2.DisplayMember = "Value"
ComboBox2.ValueMember = "Key"
Case 2
'Me.ComboBox3.DataSource = Nothing
Case 3
'Me.ComboBox4.DataSource = Nothing
Case 4
End Select
End Sub
End Class
' ComboBoxData.vb
Public Class ComboBoxData
Public Dic_typeRacco As Dictionary(Of Integer, String)
Public Dic_typePrestatsAeroSout As Dictionary(Of Integer, String)
Public Dic_typePrestatsSout As New Dictionary(Of Integer, String)
Public Sub New()
' Listing des types de raccordements
Dic_typeRacco = New Dictionary(Of Integer, String) From {
{0, "Aero Souterrain"},
{1, "Branchement Souterrain"},
{2, "Branchement Immeuble"},
{3, "Colonne Montante"},
{4, "Immeuble de 5 étages <= 44Log"},
{5, "Immeuble de 7 étages <= 44Log"},
{6, "Ft pour remplacement d'un CPE"}
}
' Liste des prestations pour l'aero souterrain
Dic_typePrestatsAeroSout = New Dictionary(Of Integer, String) From
{
{1, "Raccordement unitaire"},
{2, "2 ≤ nb raccordements ≤ 10"},
{3, "10 ≤ nb raccordements ≤ 25"},
{4, "25 < nb raccordements ≤ 50"},
{5, "50 < nb raccordements ≤ 100"},
{6, "100 < nb raccordements ≤ 250"},
{7, "250 < nb raccordements ≤ 500"},
{8, "Nb raccordements > 500"}
}
' Prestations pour un branchement Souterrain
Dic_typePrestatsSout = New Dictionary(Of Integer, String) From
{
{1, "Raccordement unitaire"},
{2, "2 ≤ nb raccordements ≤ 10"},
{3, "10 ≤ nb raccordements ≤ 25"},
{4, "25 < nb raccordements ≤ 50"},
{5, "50 < nb raccordements ≤ 100"},
{6, "100 < nb raccordements ≤ 250"},
{7, "250 < nb raccordements ≤ 500"},
{8, "Nb raccordements > 500"}
}
End Sub
End Class |