Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help Forums Windows Startup Programs Database Spyware and Malware Removal Guides Computer Tutorials Uninstall Database File Database Computer Glossary Computer Resources
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, 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.

 
Reply to this topicStart new topic
> Need Help
Shibby
post Sep 23 2004, 06:51 PM
Post #1


Member
**

Group: Members
Posts: 85
Joined: 30-May 04
Member No.: 617



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).

CODE
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: Sep 23 2004, 06:52 PM
Go to the top of the page
 
+Quote Post
Grinler
post Sep 25 2004, 11:05 PM
Post #2


Bleep Bleep!
******

Group: Admin
Posts: 28,967
Joined: 24-January 04
From: USA
Member No.: 3



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


--------------------
Lawrence
Go to the top of the page
 
+Quote Post
penmore
post Oct 16 2004, 04:26 PM
Post #3


Malware Sniffer
*****

Group: HJT Team
Posts: 757
Joined: 4-September 04
From: West Coast of Scotland
Member No.: 2,438



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
Go to the top of the page
 
+Quote Post
penmore
post Oct 17 2004, 07:24 AM
Post #4


Malware Sniffer
*****

Group: HJT Team
Posts: 757
Joined: 4-September 04
From: West Coast of Scotland
Member No.: 2,438



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 smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 8th October 2008 - 04:24 AM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Malware Removal Guides

© 2003-2008 All Rights Reserved Bleeping Computer LLC.