Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Need Help


  • Please log in to reply
3 replies to this topic

#1 Shibby

Shibby

  • Members
  • 85 posts
  • OFFLINE
  •  
  • Local time:04:26 AM

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.

Edited by Shibby, 23 September 2004 - 06:52 PM.


BC AdBot (Login to Remove)

 


#2 Grinler

Grinler

    Lawrence Abrams


  • Admin
  • 43,617 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:07:26 AM

Posted 25 September 2004 - 11:05 PM

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

#3 penmore

penmore

    Malware Sniffer


  • Members
  • 757 posts
  • OFFLINE
  •  
  • Location:West Coast of Scotland
  • Local time:12:26 PM

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 penmore

penmore

    Malware Sniffer


  • Members
  • 757 posts
  • OFFLINE
  •  
  • Location:West Coast of Scotland
  • Local time:12:26 PM

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:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users