Compte Rendu VB

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

dhouibiCompte rendu VB

d
Public Class Form1

Private Sub TextBox2_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
zn2.TextChanged

End Sub

Private Sub Button4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button4.Click

etq.Text = "+"

zn3.Text = Val(zn1.Text) + Val(zn2.Text)

End Sub

Private Sub Button3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button3.Click

etq.Text = "-"

zn3.Text = Val(zn1.Text) - Val(zn2.Text)

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

etq.Text = "*"

zn3.Text = Val(zn1.Text) * Val(zn2.Text)

End Sub

Private Sub Button1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button1.Click

etq.Text = "/"

zn3.Text = Val(zn1.Text) / Val(zn2.Text)

End Sub

Private Sub Button6_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button6.Click

End

End Sub

Private Sub R_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs)

zn1.Clear()

zn2.Clear()

zn3.Clear()

etq.Text = ""

End Sub

Private Sub R_Click_1(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles R.Click

zn1.Clear()
zn2.Clear()

zn3.Clear()

etq.Text = ""

End Sub

End Class

Public Class Form1

Dim op As String

Dim R1 As Integer

Private Sub Btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Btn2.Click

If (zn1.Text = "") Then

zn1.Text = 2

Else

zn2.Text = 2

End If

End Sub

Private Sub Btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Btn0.Click

If (zn1.Text = "") Then

zn1.Text = 0

Else

zn2.Text = 0

End If
End Sub

Private Sub Btn1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn1.Click

If (zn1.Text = "") Then

zn1.Text = 1

Else

zn2.Text = 1

End If

End Sub

Private Sub Btn3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn3.Click

If (zn1.Text = "") Then

zn1.Text = 3

Else

zn2.Text = 3

End If

End Sub

Private Sub Btn4_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn4.Click

If (zn1.Text = "") Then

zn1.Text = 4

Else

zn2.Text = 4

End If

End Sub
Private Sub Btn5_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Btn5.Click

If (zn1.Text = "") Then

zn1.Text = 5

Else

zn2.Text = 5

End If

End Sub

Private Sub Btn6_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn6.Click

If (zn1.Text = "") Then

zn1.Text = 6

Else

zn2.Text = 6

End If

End Sub

Private Sub Btn7_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn7.Click

If (zn1.Text = "") Then

zn1.Text = 7

Else

zn2.Text = 7

End If

End Sub

Private Sub Btn8_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn8.Click

If (zn1.Text = "") Then


zn1.Text = 8

Else

zn2.Text = 8

End If

End Sub

Private Sub Btn9_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Btn9.Click

If (zn1.Text = "") Then

zn1.Text = 9

Else

zn2.Text = 9

End If

End Sub

Private Sub mult_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles mult.Click

op = "*"

End Sub

Private Sub sous_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles sous.Click

op = "-"

End Sub

Private Sub add_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles add.Click

op = "+"

End Sub
Private Sub div_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles div.Click

op = "/"

End Sub

Private Sub reset_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
reset.Click

zn1.Clear()

zn2.Clear()

etq.Text = ""

End Sub

Private Sub egal_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles egal.Click

If op = "/" Then

R1 = Val(zn1.Text) / Val(zn2.Text)

etq.Text = R1

End If

If op = "+" Then

R1 = Val(zn1.Text) + Val(zn2.Text)

etq.Text = R1

End If

If op = "-" Then

R1 = Val(zn1.Text) - Val(zn2.Text)

etq.Text = R1

End If

If op = "*" Then

R1 = Val(zn1.Text) * Val(zn2.Text)

etq.Text = R1
End If

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load

End Sub
End Class
Public Class Form1

Private Sub Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Btn.Click

If Val(T2.Text) > 10 Then

L2.Items.Add(T1.Text)

Else

If (R1.Checked = True) Then

L1.Items.Add(T1.Text)

End If

If (R2.Checked = True) Then

L2.Items.Add(T1.Text)

End If

End If

T1.Clear()

T2.Clear()

T1.Focus()
End Sub

End Class

Public Class Form1


Dim taptmp(0 To 7) As Integer

Dim i As Integer = 0

Private Sub Form1_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load

End Sub

Private Sub b_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs)
Handles b.Click
Dim som As Integer = 0

Dim max As Integer


Dim min As Integer
Dim j As Integer

If (i < 7) Then
If (Val(ztn.Text) <= 50 And
Val(ztn.Text) >= -50) Then
taptmp(i) = Val(ztn.Text)

etq.Text = etq.Text & "**" &


taptmp(i)
i=i+1

Else
MsgBox("saisir un entier dans
intervale [-50,50]")
End If

Else

MsgBox("afficher la moyenne, le min


et le max ")
max = taptmp(0)
min = taptmp(0)
For j = 1 To UBound(taptmp)
som = som + taptmp(i)

If (taptmp(j) > max) Then


max = taptmp(j)
End If
If (taptmp(j) < min) Then
min = taptmp(j)

End If
End sub
End class

Public class from1

Dim T1 (0 to 4) as integer

Dim T2 (0 to 4) as integer

Private sub

Dim I as integer

Dim Kas integer

Randomize()
For ( i=0 to ubound(T1))

T1(i)=Int(Rnd()*60)+1

Etq.text=etq.text&“**“&T1(i)

Nexti

Dim j as integer

For ( j=0 to ubound(T2))

T2(j)=Int (Rnd()*60)+1

Etq.text=etq.text&“**“&T2(j)

Nextj

For i=0 to ubound(T1)

For j=0 to ubound(T2)

If ( T1(i)=T2(j))then

K=K+1

End if

Next J

Next i

Etq2.text=K

End sub

You might also like