刚接触VB6.0求代码示例
刚接触VB6.0求代码示例
那方面?
private sub command1_click()
msgbox "hello!"
end sub
[ 本帖最后由 Artless 于 2013-4-9 19:45 编辑 ]
Option Explicit Dim A() As String, iCount As Integer, Ch As Boolean Private Sub Command1_Click() Ch = False If Trim$(Text1.Text) <> "" Then If Trim$(A(0)) = "" Then A(0) = Trim$(Text1.Text) Else ReDim Preserve A(UBound(A) + 1) A(UBound(A)) = Trim$(Text1.Text) End If List1.AddItem Trim$(Text1.Text) Text1.Text = "" End If End Sub Private Sub Command2_Click() Dim i As Integer If ((iCount > 0) And (List1.ListCount > 0)) Then List1.RemoveItem iCount ReDim A(List1.ListCount - 1) For i = 0 To List1.ListCount - 1 A(i) = List1.List(i) Next i iCount = 0 End If End Sub Private Sub Command3_Click() Dim i As Integer If ((iCount > 0) And (List1.ListCount > 0)) Then Text1.Text = List1.List(iCount) If Ch = True Then A(iCount) = Trim$(Text1.Text) List1.Clear For i = 0 To UBound(A) List1.AddItem A(i), CInt(i) Next i End If Ch = False End If End Sub Private Sub Command4_Click() List1.Refresh End Sub Private Sub Form_Load() Text1.Text = "" Command1.Caption = "ADD" Command2.Caption = "Delete" Command3.Caption = "Chang" Command4.Caption = "Check" List1.Clear Ch = False: iCount = 0 ReDim A(iCount) End Sub Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then iCount = List1.ListIndex End Sub Private Sub Text1_GotFocus() Ch = True End Sub