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
| Public Class Form1
Inherits System.Windows.Forms.Form
Dim a, b As Integer
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
a = CInt(Me.TextBox1.Text)
If Me.RadioButton1.Checked Then
Me.ListBox1.Items.Add(Me.TextBox1.Text)
Me.ListBox2.Items.Add("0")
col1.Add("0")
col.Add(Me.TextBox1.Text)
Else
Me.ListBox2.Items.Add(Me.TextBox1.Text)
Me.ListBox1.Items.Add("0")
col.Add("0")
col1.Add(Me.TextBox1.Text)
End If
Dim totalc As Integer
For i As Integer = 1 To col.Count
a = col.Item(i)
totalc = totalc + CInt(a)
Next
Me.Label7.Text = totalc
Dim totald As Integer
For i As Integer = 1 To col1.Count
a = col1.Item(i)
totald = totald + CInt(a)
Next
Me.Label8.Text = totald
Me.Label9.Text = totalc - totald
Catch ex As Exception
MsgBox("données non valide")
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.RadioButton1.Checked = True
Me.Label7.Text = 0
Me.Label8.Text = 0
Me.Label9.Text = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Me.ListBox1.Items.Clear()
a = col.Count
col.Remove(a)
For i As Integer = 1 To col.Count
Me.ListBox1.Items.Add(col.Item(i))
Next
Me.ListBox2.Items.Clear()
a = col1.Count
col1.Remove(a)
For i As Integer = 1 To col1.Count
Me.ListBox2.Items.Add(col1.Item(i))
Next
Dim totalc As Integer
For i As Integer = 1 To col.Count
a = col.Item(i)
totalc = totalc + CInt(a)
Next
Me.Label7.Text = totalc
Dim totald As Integer
For i As Integer = 1 To col1.Count
a = col1.Item(i)
totald = totald + CInt(a)
Next
Me.Label8.Text = totald
Me.Label9.Text = totalc - totald
Catch ex As Exception
MsgBox("la liste est vide")
End Try
End Sub
End Class |
Partager