BleepingComputer.com: Need Help

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need Help

#1 User is offline   Shibby 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 85
  • Joined: 30-May 04

Posted 23 September 2004 - 06:51 PM

Ok...This is a VB program and i need some help

Check out the pic http://www.miamihost.net/ims/u/Shibby/Pics/untitled.JPG.

What i am trying to do is type in a Quantity (lets say 3) then select my Item (lets say Caps) then when i hit add it will * quantity * the price of caps(9.50) then write that out on the form. I know what spaceing i need and all that but i am not sure how to do this...i have tryed many ways....check my code for one failed attempt. I also want to write it to a running total..(but i think i can do that myself...just need help on this part).

Private Sub cmdAdd_Click()
    Dim AllData As String
    Dim Product As Integer
    
    AllData = Left(cboSalesman, 5)
    
    'pad Salesman 6 spaces
    AllData = AllData & Space(5 - Len(cboSalesman))

    'pad salesman and school
    AllData = AllData & Space(1 - (optWahs))
    AllData = AllData & Space(1 - (optSahs))
    
    'space between salesman and school
    AllData = AllData & " "
    
    If optWahs = True Then
        AllData = AllData & "West Albany"
    Else
        AllData = AllData & "South Albany"
    End If
    
    AllData = AllData & " "
    
    'Quantity = Val(Quantity)
    
    'If Product("Cap $9.50") = Quantity * 9.5 Then
     '   lstProduct.ListIndex = 0
   ' ElseIf Product("Shirt $8.00") = Quantity * 8# Then
    '    lstProduct.ListIndex = 1
    'ElseIf Product("Jacket $25.75") = Quantity * 25.75 Then
     '   lstProduct.ListIndex = 2
    'End If
    
    
    lstAllData.AddItem AllData
    
    'clear controls
    cboSalesman = ""
    optWahs = False
    optSahs = False
    
    txtQuantity.SetFocus


P.S. this is my 2nd program i have made for a VB class i am taking.

This post has been edited by Shibby: 23 September 2004 - 06:52 PM


#2 User is offline   Grinler 

  • Bleep Bleep!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Admin
  • Posts: 36,603
  • Joined: 24-January 04
  • Gender:Male
  • Location:USA

Posted 25 September 2004 - 11:05 PM

Wish I could help you with this....i just dont know VB well enough.

#3 User is offline   penmore 

  • Malware Sniffer
  • PipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 757
  • Joined: 04-September 04
  • Location:West Coast of Scotland

Posted 16 October 2004 - 04:26 PM

Hi Shibby,

I'm out of time tonight but will try and have a look tomorrow for you.

It's a wee while since I wrote VB but I'll give it my best shot.

Peter

#4 User is offline   penmore 

  • Malware Sniffer
  • PipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 757
  • Joined: 04-September 04
  • Location:West Coast of Scotland

Posted 17 October 2004 - 07:24 AM

Hi Shibby,

I've used basic programming in the past and have used VB but within MS Excel to do some calculations etc behind a form.

Although the example below if from MS Excel I think its the same VB. Each of the fields on your form will have a name, along with the name of the form. In my example the form is named InvDets. All you have to do to get the calculated results into the form is to make the results field on your form = the calculation.

Example:

Private Sub Trade_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If InvDets.Trade <> "" Then
InvDets.Price337 = Format(InvDets.Trade * 1.739, "##0.00")
InvDets.Totprice = Format(InvDets.Price337, "###0.00")
End If
End Sub

All this is doing is when I exit the field on the form named Trade and provided it isn't empty then calculate the fields Price337 and Totprice. You should be able to check up on the Format command to see what that is doing.

I hope this helps you.

Best of luck,
Peter :thumbsup:

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users