Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Université HASSAN 1er

Faculté des sciences et techniques SETTAT


Département chimie appliquée
Filière : procédés et ingénierie chimique

Travail à rendre Programmation

Sous l’encadrement :

Mr.S.ELMADANI

Réaliser par :
 ABAGHOUGH Brahim
EXERCICE 2 : application de gestion de météo

Module Module1
Structure saisie
Dim dat As Date
Dim température As Integer
Dim pluviométrie As Integer
End Structure
Public enrg(365) As saisie
Public col As New Collection
End Module

Public Class Form1


Dim i As Integer = 0
Dim j As Integer = 0

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

With enrg(j)
.dat = TextBox1.Text
.température = TextBox2.Text
.pluviométrie = TextBox3.Text
End With
Form2.ListBox1.Items.Clear()
col.Add(enrg)
j = j + 1
For i = 0 To j - 1
Form2.ListBox1.Items.Add(" date " & enrg(i).dat & " T(°C) " &
enrg(i).température & " Pulviométrie=" & enrg(i).pluviométrie)
Next
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Form2.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

BRAHIM ABAGHOUGH 2
Dim max As Integer = enrg(0).température
Dim datmax As Date = enrg(0).dat
For i = 0 To j - 1
If max < enrg(i).température Then
max = enrg(i).température
datmax = enrg(i).dat
End If
Next
Form3.TextBox2.Text = max
Form3.TextBox4.Text = datmax

Dim min As Integer = enrg(0).température


Dim datmin As Date = enrg(0).dat
Dim s As Integer = 0

For i = 0 To j - 1
s = s + Val(enrg(i).température)
If enrg(i).température < min Then
min = enrg(i).température
datmin = enrg(i).dat
End If
Next
Form3.TextBox1.Text = min
Form3.TextBox5.Text = datmin
Form3.TextBox3.Text = s / j
Form3.Show()

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


End
End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


ComboBox1.SelectedIndexChanged
For i = 0 To j - 1
If enrg(i).dat.Day = ComboBox1.SelectedItem Then
TextBox1.Text = enrg(i).dat
TextBox2.Text = Val(enrg(i).température)
TextBox3.Text = Val(enrg(i).pluviométrie)
End If
Next
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


Dim d As Integer
For d = 1 To 31
ComboBox1.Items.Add(d)
Next
End Sub
End Class

BRAHIM ABAGHOUGH 3
Public Class Form2

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Hide.me()
End Sub
End Class

Public Class Form3

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Me.Hide()
End Sub
End Class

BRAHIM ABAGHOUGH 4
EXERCICE 3 : Enregistrement des étudiants

Module Module1
Public Structure Etudiant
Dim nom As String
Dim prenom As String
Dim dateN As String
Dim sexe As String
Dim annébac As String
Dim specialité As String
Dim langues As String
End Structure
Public enrg(100) As Etudiant
Public col1 As New Collection
End Module

Public i As Integer = 0

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


For j = 1980 To 2018
ComboBox1.Items.Add(j)
Next
ComboBox2.Items.Add("Sc.Math")
ComboBox2.Items.Add("Sc.Exp")
ComboBox2.Items.Add("Autre")
ListBox1.Sorted = True
End Sub

Button: ajouter

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim a As String = ""
If CheckBox1.Checked = True Then
a = a + " " + CheckBox1.Text
End If
If CheckBox2.Checked = True Then
a = a + " " + CheckBox2.Text
End If
If CheckBox3.Checked = True Then
a = a + " " + CheckBox3.Text
End If
With engr(i)
.nom = TextBox1.Text
.prenom = TextBox2.Text
.dateN = DateTimePicker1.Value.Date
If RadioButton1.Checked = True Then
.sexe = RadioButton1.Text
ElseIf RadioButton2.Checked = True Then
.sexe = RadioButton2.Text
End If
.Anbac = ComboBox1.SelectedItem.ToString
.specialité = ComboBox2.SelectedItem.ToString
.langues = a
End With
col1.Add(engr)
ListBox1.Items.Add(engr(i).nom & " " & engr(i).prenom & " " & engr(i).dateN & " " &
engr(i).sexe & " " & engr(i).specialité & " " & engr(i).langues)
i = i + 1
End Sub

BRAHIM ABAGHOUGH 5
Button: Nouveau

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Text = Nothing
TextBox2.Text = Nothing
RadioButton1.Checked = False
RadioButton2.Checked = False
ComboBox1.SelectedItem = Nothing
ComboBox2.SelectedItem = Nothing
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
End Sub

Button: quitter
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
End
End Sub
End Class

BRAHIM ABAGHOUGH 6

You might also like