برنامه ي مهمان دار پرواز در هواپيما

در اين برنامه اول بايد 8 تا command درست كنيد كه اسم اونها رو واستون گذاشتم :

1.cmdassign

2.cmdtime

3.exit

4.cmddate

5.cmdcity

6.cmdciti

7.cmdadd

8.cmdremove

بعد از گذاشتن command ها حالا بايد 2 تا combo box و 1 عدد list box  بزاريد به اسمهاي :

combo box:

1.cbomeal

2.cboseat

list box:

1.lstcity

و بعد از انجام همه ي اين كارها بايد تكه كدهاي زير بنويسيد:


lstcity.Clear
cboseat.Clear
cbomeal.Clear

End Sub

Private Sub cmdadd_Click()
cbomeal.AddItem InputBox("please enter name of food", "add food")

End Sub

Private Sub cmdassign_Click()
Dim message As String
message = "destination:" + lstcity.Text + vbCr
message = message + "seatlocation:" + cboseat.Text + vbCr
message = message + "meal pereference:" + cbomeal.Text + vbCr
message = message + "time:" + cmddate.Caption + vbCr
message = message + "date:" + cmdtime.Caption + vbCr
MsgBox message, vbOKOnly + vbInformation, "your assignment"
End Sub

Private Sub cmdciti_Click()
lstcity.RemoveItem (lstcity.ListIndex)
End Sub

Private Sub cmdcity_Click()
lstcity.AddItem InputBox("please write a name of city", "addcity")
End Sub

Private Sub cmddate_Click()
cmddate.Caption = CStr(Date)
End Sub

Private Sub cmdremove_Click()
cbomeal.RemoveItem (cbomeal.ListIndex)




End Sub

Private Sub cmdtime_Click()
cmdtime.Caption = CStr(Time)
End Sub

Private Sub exit_Click()
End

End Sub

رسم دايره هرجا از فرم كه دلتون ميخواد

اول بايد يه فرم درست كنيد بعد اين كدها رو توش بنويسي

Option Explicit
Dim X1 As Single, Y1 As Single, X2 As Single, Y2 As Single

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    'Refresh your start variables
    X1 = X
    Y1 = Y
    X2 = X
    Y2 = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        'Set the DrawMode to 6 indicates the next circle drawn will be an inverted line.
        'This renders the circle invisible
        'form1.DrawWidth = form1.DrawWidth + 10
        Form1.DrawMode = 6
        If Abs(X1 - X2) > 0 Then
                'This draws an inverted circle over the previous line. Basically erasing it
                Form1.Line ((X1 - 15) - Abs(X1 - X2), (Y1 - 15) - Abs(X1 - X2))-((X1 + 15) + Abs(X1 - X2), (Y1 + 15) + Abs(X1 - X2)), , B
                Circle (X1, Y1), Abs(X2 - X1)
                'Draw  line
                'form1.DrawWidth = form1.DrawWidth - 10
                'DrawMode 13 is the default copy pen setting
                'Form1.DrawMode = 13
                'Refresh line ending values to current position
        End If
        X2 = X
        Y2 = Y
        If Abs(X1 - X2) > 0 Then Form1.Line ((X1 - 15) - Abs(X1 - X2), (Y1 - 15) - Abs(X1 - X2))-((X1 + 15) + Abs(X1 - X2), (Y1 + 15) + Abs(X1 - X2)), , B
        Circle (X1, Y1), Abs(X1 - X2)
        'Draw new line
    End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Form1.Line ((X1 - 15) - Abs(X1 - X2), (Y1 - 15) - Abs(X1 - X2))-((X1 + 15) + Abs(X1 - X2), (Y1 + 15) + Abs(X1 - X2)), , B
    Form1.DrawMode = 13
    Circle (X1, Y1), Abs(X - X1), RGB(215, 0, 0)
End Sub