Write an event procedure to generate a bill for a ready-made garments store.Assumptions can be made wherever necessary.
(B) Property(Controls Used) :
(May be some error in the output...Find out...Please correct it using Create a Link )
A) Program Design :
User will enter Item Name,Unit Price and Quantity purchased for each different items.
User will enter Item Name,Unit Price and Quantity purchased for each different items.
- Grid : rows-10 , cols-4 , fix rows-1 , fix cols-0 (Click Project--> components and select microsoft flexGrid Control 6.0 to place a Grid Control on the form)
- Command Button : Caption-Add
- Label1 : Caption-Item
- Label2 : Caption-Price
- Label3 : Caption-Qty
- Label4 : Caption-Total
- TextBox1 : Text-(Blank)
- TextBox2 : Text-(Blank)
- TextBox3 : Text-(Blank)
- Label5 : Caption-Modern Garment Shop,Font Size-14,Alignment-Centre
Dim sum As Single |
Private Sub Command1_Click() If Trim(Text1.Text) = "" Then MsgBox "Item Name is missing" Text1.SetFocus GoTo endp End If End Sub ElseIf Trim(Text2.Text) = "" Then MsgBox "item price is missing" Text2.SetFocus GoTo endp ElseIf Val(Text2.Text) = "" Then MsgBox "Item Quantity is missing" Text3.SetFocus GoTo endp ElseIf Trim(Text3.Text) = "" Then MsgBox "Item Quantity is missing" Text3.SetFocus GoTo endp ElseIf Val(Text3.Text) <= 0 Then MsgBox "Item Quantity must be positive.Enter again" Text3.SetFocus GoTo endp Else 'if all inputs are validated,make entry in list grid1.Col = 0 grid1.Text = Trim(Text2.Text) grid1.Col = 1 grid1.Text = Trim(Text2.Text) grid1.Col = 2 grid1.Text = Trim(Text3.Text) grid1.Col = 3 item_total = Val(Text2) * Val(Text3) grid1.Text = item_total sum = sum + item_total Text4.Text = sum grid1.Row = grid1.Row + 1 End If endp: End Sub |
Private Sub Form_Load() sum = 0 grid1.ColWidth(0) = 2000 grid1.ColWidth(1) = 1200 grid1.ColWidth(2) = 500 grid1.ColWidth(3) = 1300 grid1.Row = 0 grid1.Col = 0 grid1.Text = "Item Name" grid1.Col = 1 grid1.Text = "Item Price" grid1.Col = 2 grid1.Text = "Qty" grid1.Col = 3 grid1.Text = "Item Total" grid1.Col = 0 grid1.Row = 1 |
==========================================================================
2 comments:
this very help for us thanks for that
we need rdms and tcp/ip programing
question and answer
Dim sum As Single
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
MsgBox "Item Name is missing"
Text1.SetFocus
GoTo endp
ElseIf Trim(Text2.Text) = "" Then
MsgBox "item price is missing"
Text2.SetFocus
GoTo endp
ElseIf Val(Text2.Text) <= 0 Then
MsgBox "Item price must be positive.Enter again"
Text2.SetFocus
GoTo endp
ElseIf Trim(Text3.Text) = "" Then
MsgBox "Item Quantity is missing"
Text3.SetFocus
GoTo endp
ElseIf Val(Text3.Text) <= 0 Then
MsgBox "Item Quantity must be positive.Enter again"
Text3.SetFocus
GoTo endp
Else 'if all inputs are validated,make entry in list
grid1.Col = 0
grid1.Text = Trim(Text2.Text)
grid1.Col = 1
grid1.Text = Trim(Text2.Text)
grid1.Col = 2
grid1.Text = Trim(Text3.Text)
grid1.Col = 3
item_total = Val(Text2) * Val(Text3)
grid1.Text = item_total
sum = sum + item_total
Text4.Text = sum
grid1.Row = grid1.Row + 1
End If
endp:
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
sum = 0
grid1.ColWidth(0) = 2000
grid1.ColWidth(1) = 1200
grid1.ColWidth(2) = 500
grid1.ColWidth(3) = 1300
grid1.Row = 0
grid1.Col = 0
grid1.Text = "Item Name"
grid1.Col = 1
grid1.Text = "Item Price"
grid1.Col = 2
grid1.Text = "Qty"
grid1.Col = 3
grid1.Text = "Item Total"
grid1.Col = 0
grid1.Row = 1
End Sub
++++++++++++++++++++
Text4 is not added in in the form
additionally i have added close button
Post a Comment