Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Compte Rendu VB Net

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 19

UNIVERSITE HASSAN 1er

ECOLE SUPERIEURE DE TECHNOLOGIE

BERRECHID

Baroudi Nizar

Licence Universitaire Professionnelle

Génie informatique

A.U : 2010/2011
FORME 2 : AFFICHAGE DE LA DATE ET DU TEMP

CODE SOURCE :

Public Class Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
TextBox1.Text = DateTimePicker1.Value.Date
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox2.Text = DateTimePicker1.Value.Day
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
TextBox3.Text = DateTimePicker1.Value.Month
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
TextBox4.Text = DateTimePicker1.Value.Year
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)
Form3.Show()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
FORME 3: ALIGNEMENT DU TEXTE

CODE SOURCE:

Public Class Form3


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.TextAlign = HorizontalAlignment.Left
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.TextAlign = HorizontalAlignment.Center
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
TextBox1.TextAlign = HorizontalAlignment.Right
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Form4.Show()
Me.Hide()
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
FORME 4 ,9 : MSG BOX, CALCULE DU MONTANT DU PRODUIT

CODE SOURCE:

Public Class Form4


Dim produit As String
Dim prix, montant As Double
Dim qte As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
prix = TextBox2.Text
qte = TextBox3.Text
montant = prix * qte
TextBox4.Text = montant
MsgBox("le produit est :" & TextBox1.Text & " le prix unitaire est
:" & prix & " la quantité est:" & qte & " le montant est:" & montant)
End Sub
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub
End Class

FORME 5 : CONVERTUSSEUR

CODE SOURCE :

Public Class Form5


Dim A, b As Double
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
A = TextBox1.Text
TextBox2.Text = A * 11 & " DHs"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
b = TextBox2.Text
TextBox1.Text = b / 11 & " Euro"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
FORME 6 : REMPLISSAGE ET SUPPRESSION DES LISTES

CODE SOURCE :

Public Class Form6


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Add("siham")
ListBox1.Items.Add("soufiane")
ListBox1.Items.Add("abdelilah")
ListBox1.Items.Add("nizar")
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
TextBox1.Text = ListBox1.Items.Count
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
ListBox1.Items.Clear()
End Sub
Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
FORME 7 :GESTION DES NOTES

CODE SOURCE :

Public Class Form7


Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = " "
TextBox2.Text = ListBox1.Items.Count
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = " "
TextBox2.Text = ListBox1.Items.Count
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
TextBox2.Text = ListBox1.Items.Count
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
ListBox1.Items.Clear()
TextBox2.Text = ListBox1.Items.Count

End Sub
End Class

FORME 8 : GESTION DACHAT DES MATERIELS INFORMATIQUE

CODE SOURCE :

Option Explicit On
Public Class Form8
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Checked = True Then
TextBox2.Text = 500
End If
End Sub
Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
TextBox1.Text = 500
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
TextBox1.Text = 1000
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked = True Then
TextBox1.Text = 2000
End If
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
If RadioButton5.Checked = True Then
TextBox2.Text = 1000
End If

End Sub
Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
If RadioButton6.Checked = True Then
TextBox2.Text = 1500
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox3.Text = Val(TextBox3.Text) + 500
Else
TextBox3.Text = Val(TextBox3.Text) - 500
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
TextBox3.Text = Val(TextBox3.Text) + 200
Else
TextBox3.Text = Val(TextBox3.Text) - 200
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
TextBox3.Text = Val(TextBox3.Text) + 150
Else
TextBox3.Text = Val(TextBox3.Text) - 150
End If
End Sub
Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
TextBox4.Text = ""
RadioButton8.Checked = False
RadioButton7.Checked = True
TextBox4.Text = "10%"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox5.Text = Val(TextBox1.Text) + Val(TextBox2.Text) +
Val(TextBox3.Text)
If TextBox5.Text >= 2000 Then
RadioButton7.Enabled = False
RadioButton8.Enabled = True
TextBox4.Text = Val(TextBox5.Text) * 0.2
Else
RadioButton8.Enabled = False
RadioButton7.Enabled = True
TextBox4.Text = Val(TextBox5.Text) * 0.1
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox6.Text = Val(TextBox5.Text) - Val(TextBox4.Text)
End Sub
End Class

FORME 10 : SAISIE DES NOTES

CODE SOURCE:

Public Class Form10


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim a As String
For i = 0 To 10
a = InputBox("entrer une valeur")
ListBox1.Items.Add(a)
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = InputBox("entrer un nom")
End Sub
Private Sub Form10_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
FORME 11 : GESTION DE DEPLACEMENT

CODE SOURCE:

Public Class Form11


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim i As Integer
For i = 0 To ListBox1.Items.Count - 1
ListBox2.Items.Add(ListBox1.Items(i))
Next
ListBox1.Items.Clear()
End Sub
Private Sub Form11_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("ordinateur")
ListBox1.Items.Add("Clavier")
ListBox1.Items.Add("Sourie")
ListBox1.Items.Add("D.D")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox2.Items.Add(ListBox1.SelectedItem)
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ListBox1.Items.Add(ListBox2.SelectedItem)
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim i As Integer
For i = 0 To ListBox2.Items.Count - 1
ListBox1.Items.Add(ListBox2.Items(i))
Next
ListBox2.Items.Clear()
End Sub
End Class

FORME 12 : GESTION DES NOTES ( SOMME,MOYENNE,MAX ,MIN )

CODE SOURCE :

Public Class Form12


Public som As Double
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ListBox1.SelectedIndexChanged
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ListBox1.Items.Clear()
For i As Integer = 0 To 3
ListBox1.Items.Add(InputBox("saisir la note"))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
For i As Integer = 0 To ListBox1.Items.Count - 1
TextBox1.Text = Val(TextBox1.Text) + Val(ListBox1.Items(i))
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
For i As Integer = 0 To ListBox1.Items.Count - 1
TextBox1.Text = Val(TextBox1.Text) + Val(ListBox1.Items(i))
Next
TextBox2.Text = Val(TextBox1.Text / ListBox1.Items.Count)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
TextBox3.Text = ""

Dim max As Integer


max = ListBox1.Items(0)

For i As Integer = 0 To ListBox1.Items.Count - 1


If ListBox1.Items(i) > max Then
max = ListBox1.Items(i)
End If
Next
TextBox3.Text = max
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
TextBox4.Text = ""
Dim min As Integer
min = ListBox1.Items(0)
For i As Integer = 0 To ListBox1.Items.Count - 1
If ListBox1.Items(i) < min Then
min = ListBox1.Items(i)
End If
Next
TextBox4.Text = min
End Sub
Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class

FORME 13 :SOMME DES NOTES

CODE SOURCE :
Public Class Form13
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim NoteBD As Integer
For i As Integer = 0 To 9
NoteBD = InputBox("Saisir la Note de Base de Donnée ")
If NoteBD >= 0 And NoteBD <= 20 Then
ListBox1.Items.Add(NoteBD)
Else
MsgBox("NoteBD Incorrecte")
End If
Next
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim NoteLC As Integer
For i As Integer = 0 To 9
NoteLC = InputBox("Saisir la Note de Base de Donnée ")
If NoteLC >= 0 And NoteLC <= 20 Then
ListBox2.Items.Add(NoteLC)
Else
MsgBox("Note Langage C Incorrecte")
End If
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim som As Integer
For i As Integer = 0 To 9
som = ListBox1.Items(i) + ListBox2.Items(i)
ListBox3.Items.Add(som)
Next
End Sub
Private Sub Form13_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class

FORME 14 : REPLISSAGE DE LA LISTE AVEC DIFFERENTS NBR EXCEPT LE NBR 0


CODE SOURCE:

Public Class Form14


Private Sub ListBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ListBox1.SelectedIndexChanged
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim I As Integer = 1
Do While I <> 0
I = InputBox("Entrer la Note ")
ListBox1.Items.Add(I)
Loop
ListBox1.Items.RemoveAt(ListBox1.Items.Count() - 1)
End Sub
Private Sub Form14_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class

FORME 15 :STRUCTURE DES ETUDIANTS


CODE SOURCE:

Public Class Form15


Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With enregistrement
.Code_Etud = TextBox1.Text
.Nom_Etud = TextBox2.Text
.Date_Nais = TextBox3.Text
.Nbre_Dip = TextBox4.Text
End With
col_enregistrement.Add(enregistrement)
For Each enregistremen In col_enregistrement
col_enregistrement.Clear()

ListBox1.Items.Add(TextBox1.Text & " " & TextBox2.Text & " " &
TextBox3.Text & " " & TextBox4.Text)
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Private Sub Form15_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add(choix.homme)
ComboBox1.Items.Add(choix.femme)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
End Sub
End Class

FORME 16 ,17 : REMPLISSAGE ET AFFICHAGE D4UNE STRUCTURE

CODE SOURCE :

Public Class Form16

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With enregEmp
.Nom_Empl = TextBox1.Text
.Date_Nais = DateTimePicker1.Value.Date
.Date_Emb = DateTimePicker2.Value.Date
.Fonction = TextBox2.Text
.Type_Emp = ComboBox1.SelectedItem
End With
col_enregEmp.Add(enregEmp)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Form17.Show()
End Sub
Private Sub Form16_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add(TE.Intermitant)
ComboBox1.Items.Add(TE.Permanent)
ComboBox1.Items.Add(TE.Temporaire)
End Sub
End Class

Public Class Form17


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
For Each enregEmp In col_enregEmp
ListBox1.Items.Add(enregEmp.Nom_Empl & " " & enregEmp.Date_Nais
& " " & enregEmp.Date_Emb & " " & enregEmp.Fonction & " " &
enregEmp.Type_Emp.ToString)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form16.Show()
Me.Hide()
End Sub
Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class

FORME 18 : MAJISCUL ET MINISCUL DUNE CHAINE DE CARACTERE


CODE SOURCE :

Public Class Chaine_Car


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox2.Text = UCase(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox3.Text = LCase(TextBox1.Text)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
TextBox4.Text = Len(TextBox1.Text)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim i As Integer
Dim nbre As Integer
For i = 0 To Len(TextBox5.Text) - 1
If TextBox6.Text = TextBox5.Text(i) Then
nbre = nbre + 1
End If
Next
TextBox7.Text = nbre
End Sub
Private Sub Chaine_Car_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub
End Class

You might also like