VB学习廷哥培训
基础培训
类相当于一个虚拟事物
需要定义其内容,定义完成可直接调用 共享不用实体化
Public Class Form1
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim tR As Random = New Random
Dim k As Integer = tR.Next(0, 100)
Dim tD As Double = tR.NextDouble()
Dim i As Integer = 0
For i = 1 To 100
k = tR.Next(0, 100)
tD = tR.NextDouble()
ListBox1.Items.Add("整数:" & k.ToString & " .小敏" & tD.ToString)
ListBox1.SelectedIndex = ListBox1.Items.Count - 1
My.Application.DoEvents()
Dim tR As Random = New Random
Dim k As Integer = tR.Next(0, 100)
Dim tD As Double = tR.NextDouble()
Dim i As Integer = 0
For i = 1 To 100
k = tR.Next(0, 100)
tD = tR.NextDouble()
ListBox1.Items.Add("整数:" & k.ToString & " .小敏" & tD.ToString)
ListBox1.SelectedIndex = ListBox1.Items.Count - 1
My.Application.DoEvents()
Next
End Sub
Private Sub ListBox1_DobulicClick(sender As Object, e As EventArgs) Handles ListBox1.DoubleClick
Dim tResult As Integer = -1
tResult = MsgBox("确定要清空列表吗?", vbAbort)
If tResult = MsgBoxResult.Yes Then
ListBox1.Items.Clear()
Private Sub ListBox1_DobulicClick(sender As Object, e As EventArgs) Handles ListBox1.DoubleClick
Dim tResult As Integer = -1
tResult = MsgBox("确定要清空列表吗?", vbAbort)
If tResult = MsgBoxResult.Yes Then
ListBox1.Items.Clear()
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged_1(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
End Class
End Class
浙公网安备 33010602011771号