nha hang ban me

Dim x As Long

Dim y As Long 'de chu chay ngang qua phai khai bao bien general

Private Sub C1_Click()

Dim a As Boolean

a = True

For i = 0 To Li1.ListCount - 1

If UCase(Li1.List(i)) = UCase(t1.Text) Then

a = False

End If

Next i

If a = True Then

Li1.AddItem t1.Text

t1.Text = ""

Else

MsgBox ("Mon nay da co trong thuc don")

t1.Text = ""

End If

End Sub

Private Sub c2_Click()

If Li1.ListIndex >= 0 Then

Li1.RemoveItem Li1.ListIndex

End If

If Li2.ListIndex >= 0 Then

Li2.RemoveItem Li2.ListIndex

End If

End Sub

Private Sub Command1_Click()

If Li1.ListIndex >= 0 Then

Li2.AddItem Li1.List(Li1.ListIndex)

Li1.RemoveItem Li1.ListIndex

End If

End Sub

Private Sub Command2_Click()

If Li2.ListIndex >= 0 Then

Li1.AddItem Li2.List(Li2.ListIndex)

Li2.RemoveItem Li2.ListIndex

End If

End Sub

Private Sub Form_Load()

c1.Enabled = False

c2.Enabled = False

x = 100

y = 50

End Sub

Private Sub Li1_Click()

c2.Enabled = True

c1.Enabled = False

End Sub

Private Sub Li2_Click()

c1.Enabled = False

c2.Enabled = True

End Sub

Private Sub t1_Click()

c1.Enabled = True

c2.Enabled = False

End Sub

Private Sub t1_KeyPress(KeyAscii As Integer)

If (KeyAscii = 13) Then 'de thuc hien nhan phim enter khong can ("13")

Li1.AddItem t1.Text 'neu dung no khong chay

t1.Text = ""

End If

End Sub

Private Sub Timer1_Timer()

l2.Move x

If (x + l2.Width > Width) Or (x < 0) Then

y = -y

End If

x = x + y

l2.ForeColor = Rnd(10) * 100000

End Sub

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: