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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
   | Imports System.Windows.Forms 
 
Imports 
 
Microsoft.VisualBasic 
Imports 
 
System.IO 
Public Partial Class 
 
Form1 
 
Public app As object 
 
Public ofd1 As New OpenFileDialog 
 
Public cl, f As Object 
 
Public nbligne As Integer 
 
Public Sub New () 
 
Me .InitializeComponent() 
app=createobject("excel.application") 
 
app.visible= 
 
false 
 
app.screenUpdating= False 
 
'on ouvre le fichier 
 
app.workbooks.open(filename) 
cl=app.workbooks.item(1) 
 
f=app.worksheets.item(1) 
 
End Sub 
 
Sub 
 
Button5Click( ByVal sender As Object , ByVal e As EventArgs) 
Mainform.show 
 
Me .Hide 
 
End Sub 
 
Sub 
 
Button4Click( ByVal sender As Object , ByVal e As EventArgs) 
 
Tmin.Text="" 
 
Tmax.Text="" 
 
Tmoy.Text="" 
 
Tecart.Text="" 
 
Tet.Text="" 
 
Tq1.Text="" 
 
Tq2.Text="" 
 
Tq3.text="" 
 
End Sub 
 
Sub 
 
Button1Click( ByVal sender As Object , ByVal e As EventArgs) 
 
Dim j As Integer 'j=colonnes 
 
For j=48 To 50 
listBox1.items.Add(f.cells(1,j).value) 
 
listbox1.items.Remove(f.cells(1,3).value) 
 
Next j 
 
End Sub 
 
Sub 
 
Button2Click( ByVal sender As Object , ByVal e As EventArgs) 
 
Dim variable As String 
 
Label11.Text = listbox1.selecteditem 
variable = listbox1.selecteditem 
 
End Sub 
 
Sub 
 
Button3Click( ByVal sender As Object , ByVal e As EventArgs) 
 
Dim i, j As Integer 
 
Dim cpt1, cpt2 As Integer , cpt3 as Integer 
 
dim b, k as String 
 
Dim som2, som3, Somme, vari As single 'Variables somme 
 
dim a as string 
 
'Dim Numerodecolonne() As Integer 
 
Dim numerocolonne As Integer 
 
Dim min, max As Single 
 
nbligne = 0 
 
app=createobject("excel.application") 
 
app.visible= 
 
false 
 
app.screenUpdating= false 
 
'on ouvre le fichier 
 
Numerocolonne = f.cells.find(label11.Text).Column 
 
'pour trouver le nombre de lignes 
 
nbligne=0 
 
Do 
 
nbligne=nbligne+1 
 
Loop Until Convert.ToString(f.cells(nbligne+1,1).value)="" 
 
'If isnumeric(f.cells(2,numerocolonne).value) = True then 
'variable quantitative 
 
For i=2 To nbligne 
 
if f.cells(Numerocolonne,i).value<>"" then 
 
Somme += f.cells(i,Numerocolonne).value 
cpt3=cpt3+1 
 
end if 
Next 
 
i 
 
'calcule de la moyenne 
 
Tmoy.Text = somme/cpt3 
 
for i=2 to nbligne 
 
For j=1 To nbligne-i 
 
Do 
 
a = f.cells(i+j,Numerocolonne).value 
 
f.cells(i+j,Numerocolonne).value = f.cells(i,Numerocolonne).value 
 
f.cells(i,Numerocolonne).value = a 
 
Loop until (f.cells(i,Numerocolonne).value <= f.cells(i+j,Numerocolonne).value) 
 
next j 
 
Next i 
 
'calcul du minimum et maximum 
 
min = f.cells(2,Numerocolonne).value 
max = f.cells(nbligne,Numerocolonne).value 
 
Tmin.Text=min 
 
Tmax.Text=max 
 
'calcul de l'étendue 
 
Tet.Text = max-min 
 
'calcul de la médiane 
 
Tq2.Text = f.cells((nbligne/2),numerocolonne).value 
 
'calcul des quartiles 
 
Tq1.Text = f.cells((nbligne)/4, numerocolonne).value 
Tq3.Text = f.cells((nbligne)-((nbligne)/4), numerocolonne).value 
 
'calcul de l'écart-type 
 
For i = 2 To nbligne 
som2 += (f.cells(i,numerocolonne).value)^2 
 
Next i 
som3 = som2 - ((somme/nbligne)^2) 
 
vari = som3/(nbligne) 
 
Tecart.Text = 
 
string .Format("{0:F2}",(vari)^(1/2)) 
 
'Else 
 
'variable qualitative 
 
'cpt1 = 0 
 
'cpt2 = 0 
 
b = f.cells(2,numerocolonne).value 
 
For i = 2 To nbligne 
 
'for j=2 to nbligne-i 
 
If ( f.cells(i,numerocolonne).value) = (f.cells(i+1,numerocolonne).value) Then 
 
cpt1 = cpt1+1 
 
Else 
 
k = f.cells(i,numerocolonne).value 
cpt2 = cpt2+1 
 
End If 
 
'next j 
 
Next i 
 
label3.Text = (f.cells(2,numerocolonne).value) 
 
label5.Text = k 
 
Tmin.Text = 
 
string .Format("{0:F2}",cpt1/(cpt1+cpt2)) 
Tmoy.Text = 
 
string .Format("{0:F2}",cpt2/(cpt1+cpt2)) 
 
'End If 
 
End Sub 
End Class | 
Partager