Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim t As Integer, f As Single, x As String
t = Val(TextBox1.Text)
f = 7.69 * t
x = Str$(f) + "元"
Label2.Text = x
TextBox1.Focus()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Text = ""
checkbox和radiobutton的区别Label2.Text = ""
End Sub
End Class
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Integer
If TextBox1.Text = "" Then
TextBox1.Focus() '在文本框1输入身高
MsgBox("请输入身高")
Exit Sub
End If
If TextBox2.Text = "" Then
TextBox2.Focus() '在文本框2输入体重
MsgBox("请输入体重")
Exit Sub
End If
'选择性别
If RadioButton1.Checked = False And RadioButton2.Checked = False Then '此种情况不会发生
MsgBox("请选择被检测者性别")
Exit Sub
End If
If RadioButton1.Checked = True Then
x = Val(TextBox1.Text) - 100 '计算男性体重
ElseIf RadioButton2.Checked = True Then
x = Val(TextBox1.Text) - 105 '计算女性体重
End If
'判断体重是否超标,并显示
If Val(TextBox2.Text) > x Then
Label3.Text = "体重超标,请注意饮食与运动!"
Else
Label3.Text = "体重正常"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'清除计算体重和超标提示
Label3.Text = "" : TextBox1.T ext = "" : TextBox2.Text = ""
RadioButton1.Checked = False : RadioButton2.Checked = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End '结束工程运行
End Sub
End Class
Public Class Form3
Dim x As Integer, varstring As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox3.Enabled = False
Button1.Enabled = False
TextBox3.Font = New Font("宋体", 10, FontStyle.Regular)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B
utton2.Click
Select Case True
Case CheckBox1.Checked = True And CheckBox2.Checked = False
TextBox3.Font = New Font("宋体", 10, FontStyle.Bold)
Case CheckBox2.Checked = True And CheckBox1.Checked = False
TextBox3.Font = New Font("宋体", 10, FontStyle.Italic)
Case CheckBox1.Checked And CheckBox2.Checked
TextBox3.Font = New Font("宋体", 10, FontStyle.Bold Or FontStyle.Italic) Case CheckBox1.Checked = False And CheckBox2.Checked = False
TextBox3.Font = New Font("宋体", 10, FontStyle.Regular)
End Select
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox3.Enabled = True
TextBox3.Text = T extBox1.Text & TextBox2.T ext
If RadioButton1.Checked = True Then
TextBox3.Text = T extBox3.Text & RadioButton1.Text
ElseIf RadioButton2.Checked = True Then
TextBox3.Text = T extBox3.Text & RadioButton2.Text
End If
End Sub
Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
x = Len(TextBox1.Text)
If x <> 6 Then
Beep()
TextBox1.Text = ""
TextBox1.Focus()
TextBox3.Clear()
TextBox3.Text = "病历号为6位数字"
Else
TextBox3.Clear()
Button1.Enabled = True
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Public Class Form4
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(ComboBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If ListBox1.SelectedIndex = -1 Then
MsgBox("请选择要删除的书!")
Exit Sub
End If
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListBox1.Items.Clear()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim num As Integer
num = ListBox1.Items.Count
For i = 0 Tonum - 1
If ListBox1.Items(i) = "内科学" Or ListBox1.Items(i) = "外科学" Then
MsgBox("您已经借阅了一本期刊,不能再借阅期刊!")
Exit Sub
End If
Next i
If RadioButton1.Checked = True Then
ListBox1.Items.Add("内科学")
ElseIf RadioButton2.Checked = True Then
ListBox1.Items.Add("外科学")
End If
End Sub
End Class
Public Class Form5
Dim VarAs String, Hx As Integer, Vx As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Var$ = ComboBox1.Text + ComboBox2.Text + ComboBox3.Text + ComboBox4.Text
Select Case Var$
Case Is = "肿痛轻度38度干咳"
TextBox1.Text = "咽炎"
Case Is = "化脓中度39度早起咳"
TextBox1.Text = "扁桃体发炎"
Case Is = "化脓重度40度有痰"
TextBox1.Text = "肺炎"
Case Else
TextBox1.Text = "重选"
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
ListBox2.Items.Add(ListBox1.Text)
End Sub
Private Sub ListBox2_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick
'首先判断列表框中的项是否大于0
If (ListBox2.Items.Count > 0) Then
'移出选择的项()
ListBox2.Items.Remove(ListBox2.SelectedItem)
End If
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("一")
ComboBox1.Items.Add("二")
ComboBox1.Items.Add("三")
ComboBox1.Items.Add("四")
ComboBox1.SelectedIndex = 0
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Select Case ComboBox1.SelectedIndex
Case 0
PictureBox1.Image = My.Resources.xiamen1
Case 1
PictureBox1.Image = My.Resources.xiamen2
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论