Results 1 to 8 of 8

Thread: please help!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    4

    please help!!!

    Hi Hope you can help because its driving me up the wall.

    I've made a program that can add 4 items in a row in a list box, for instance

    Item Make Guarentee qty Price
    toy car rover 1 1 £45.00
    monkey monkey 2 1 £65.00

    total: £100.00

    The problem is I can't get the price to total up in a lable or textbox, however,
    I can make it work if i seperate the box and make two, listbox1 for item,make,gtee, qty and listbox 2 for price only.

    I don't want this because i want the row to delete in one go instead of deleting it from two boxes which is a time taker. code below

    I've worked out how to delete and make it add up right its just the two boxes i cant get my head around.

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Dim Model As String
    Dim Make As String
    Dim Guarantee As Integer = 0
    Dim price As Double = 0
    Dim qty As Integer = 0
    Dim Discount As Double = 0
    Dim DelCharge As Double = 0
    Dim Subtotal As Double = 0
    Dim total As Double = 0
    Dim totalpayment As Double = 0

    'find user input and assign values to their variables
    Model = (ModelNotextbox.Text)
    Make = (Maketextbox.Text)
    Guarantee = Val(Guaranteecombobox.Text)
    price = Val(Pricetextbox.Text)
    qty = Val(Qtytextbox.Text)

    'Price * qty
    totalpayment = price * qty

    'display data in list box
    ListBox1.Items.Add(Model & ControlChars.Tab & ControlChars.Tab & Make & ControlChars.Tab & Guarantee & ControlChars.Tab & qty & ControlChars.Tab)

    ListBox2.Items.Add(String.Format("{0:c}", totalpayment))

    'Adds list box prices together *
    Dim totals As Integer

    For Each value As Double In ListBox2.Items
    totals += value
    Next
    Label28.Text = (String.Format("{0:c}", totals))

    'Clear previous items
    ModelNotextbox.Clear()
    Maketextbox.Clear()
    Guaranteecombobox.Refresh()
    Pricetextbox.Clear()

    End Sub

    Thanks alot for the help!

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: please help!!!

    FYI, you are posting .Net related code/questions in the VB6 forum. And you should not post the same question multiple times.

    A moderator may be along soon to move both of your threads to the correct forum.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    4

    Re: please help!!!

    Quote Originally Posted by LaVolpe View Post
    FYI, you are posting .Net related code/questions in the VB6 forum. And you should not post the same question multiple times.

    A moderator may be along soon to move both of your threads to the correct forum.

    sorry I didn't know, I'm new to this..

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    4

    Re: please help!!!

    the forum sub title says vb 6 and ealier how is it vb.net

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: please help!!!

    Quote Originally Posted by TheCodeHunter View Post
    the forum sub title says vb 6 and ealier how is it vb.net
    You will not see the following System parameter types in VB6:
    ByVal sender As System.Object, ByVal e As System.EventArgs

    Also, the control names and class names used in your code is a dead giveaway.

    Edited: VB6 is about a decade older than .Net
    Last edited by LaVolpe; Nov 16th, 2009 at 12:59 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: please help!!!

    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

    Also, please post each question (or variation of it) only once - I have deleted all of the duplicates you posted (even the ones you made after LaVolpe asked you not to do it).

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    4

    Re: please help!!!

    well i'm still learning to suck eggs when it comes to coding, could you be of any help with this? ty

  8. #8
    Fanatic Member TokersBall_CDXX's Avatar
    Join Date
    Mar 2003
    Location
    America
    Posts
    571

    Re: please help!!!

    a simple search on the forum could possibly steer you in the correct direction.
    anyhoo, kevininstructor just recently posted an excellent way to handle this on another post.

    http://www.vbforums.com/showpost.php...73&postcount=3
    Build your own personalized flash based chat room for your webpage for FREE! http://www.4computerheaven.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width