Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub btn_run_Click(sender As System.Object, e As System.EventArgs) Handles btn_run.Click
- Dim msgTxt As String = "你選的是" & vbCrLf 'vbCrLf換行
- Dim ObjCB As CheckBox
- For Each tmpCB As Object In Me.Controls '將所有在Form1的控制項全部巡迴一次
- If tmpCB.GetType.ToString() = "System.Windows.Forms.CheckBox" Then
- ObjCB = CType(tmpCB, CheckBox)
- If ObjCB.Checked Then
- msgTxt = msgTxt + ObjCB.Text + vbCrLf
- End If
- End If
- Next
- MsgBox(msgTxt)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement