|
-
Oct 20th, 2009, 05:20 AM
#1
Thread Starter
Registered User
clear function
im learning VB.Net
i have a program with checkboxes in a form. i have a button that outputs a message box with the choices i have ticked on the checkboxes. the button shows the ones i select but also the previous ones. i have another button "clear" but i dont know how to remove the selections from the messagebox
here is my code
Public Class Form1
Dim Message As String
Dim Counter As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If CheckBox1.CheckState = 1 Then
Message = Message & CheckBox1.Text & vbNewLine
Counter = Counter + 1
End If
If CheckBox2.CheckState = 1 Then
Message = Message & CheckBox2.Text & vbNewLine
Counter = Counter + 1
End If
If CheckBox3.CheckState = 1 Then
Message = Message & CheckBox3.Text & vbNewLine
Counter = Counter + 1
End If
If CheckBox4.CheckState = 1 Then
Message = Message & CheckBox4.Text & vbNewLine
Counter = Counter + 1
End If
If CheckBox5.CheckState = 1 Then
Message = Message & CheckBox5.Text & vbNewLine
Counter = Counter + 1
End If
MsgBox("You have chosen" & vbNewLine & Message)
MsgBox("Counter = " & Counter)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
End Class
thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|