Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Friday, July 1, 2011

VB-29 : Generate a bill for a ready-made garment store

Write an event procedure to generate a bill for a ready-made garments store.Assumptions can be made wherever necessary.

A) Program Design : 
User will enter Item Name,Unit Price and Quantity purchased for each different items.

(B) Property(Controls Used) :

  1. 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)
  2. Command Button         :    Caption-Add
  3. Label1                            :   Caption-Item
  4. Label2                            :   Caption-Price
  5. Label3                            :   Caption-Qty
  6. Label4                            :   Caption-Total
  7. TextBox1                       :   Text-(Blank)
  8. TextBox2                       :   Text-(Blank)
  9. TextBox3                       :   Text-(Blank)
  10. Label5                            :   Caption-Modern Garment Shop,Font Size-14,Alignment-Centre
(C) Attaching Code to the Object :



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

End Sub
(May be some error in the output...Find out...Please correct it using Create a Link  )

========================================================================== 
Back to Home   &  VB
=====

2 comments:

mec said...

this very help for us thanks for that
we need rdms and tcp/ip programing
question and answer

Niraj said...

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