TD Ecercice 1

You might also like

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

Td

Ecercice 1

Class form1

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


System.EventArgs) Handles Button1.Click
If v.Chars((v.Length - 2)) & v.Chars((v.Length - 1)) = "er" Then
v = v.Substring(0, v.Length - 2)
t = {"je" & " " & v & "e" & "," & "tu" & " " & v & "es" + "," & "il" & " " & v
& "e" & "," & "nous" & " " & v & "ons" & "," & "vous" & " " & v & "ez" & " ils " & " " & v
& "ent"}
ElseIf v.Chars((v.Length - 2)) & v.Chars((v.Length - 1)) = "ir" Then
v = v.Substring(0, v.Length - 2)

t = {"je" & "" & v & "is" & "," & "tu" & " " & v & "is " + "," & "il" & " " &
v & "it" & "," & "nous" & " " & v & "issons" & "," & "vous" & " " & v & "issez" & " ils "
& " " & v & " issent "}
Else
MsgBox("essayer de nouveau")
End If
For Each item As String In t
ListBox1.Items.Add(item)

Next
End Sub

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


Handles MyBase.Load
v = InputBox("donner un verbe")
z1.text = v

End Sub

End Class

Exercice 2

Public Class Form1


Dim ph As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
ph = InputBox("donner une phrase")
textbox10.text = ph
End Sub

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


System.EventArgs) Handles Button1.Click
Dim a As Char
Dim i As Integer
For i = 0 To ph.Length - 1
a = ph.Chars(i)
If a = " " Then
ph = ph.Replace(" ", "/")
End If
Next
TextBox1.Text = ph
Return (TextBox1.Text)

End Function

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


System.EventArgs) Handles Button2.Click
Dim sph As String
Dim p, n As Integer
p = Val(InputBox("donner la position"))
n = Val(InputBox("donner le nombre de caractere "))
sph = ph.Substring(p, n)
TextBox2.Text = sph
Return (TextBox2.Text)

End Function
End Class

Exercice 3

Public Class Form1

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


Handles MyBase.Load
Dim s1, s2, s3 As String
Dim testcomp As Integer

s1 = InputBox("donner une chaine")


s2 = InputBox("donner une chaine")
s3 = InputBox(" donner une chaine ")
testcomp = StrComp(s1, s2)
If testcomp = 0 Then

s2 = Replace(s2, s2, s3)

MsgBox(s1 & " " & s2)


End If

testcomp = StrComp(s1, s3)


If testcomp = 0 Then

s3 = Replace(s3, s3, s2)

MsgBox(s1 & " " & s3)


End If

End Sub
End Class
Excercice 4

You might also like