VS 2008 Calculate Price * Quantity = Cost?

Mar 3, 2010

I certainly hope I don't aggravate you with what is certainly a very simple code problem. I have never programmed before, but I do have a background in tech support, etc. I have an assignment to do and it's frustrating to wade through the information out there to find exactly what I need and nothing more.The assignment has 3 parts, one of which i've done. We are to do the same function in both javascript and VB. I was able to take a sample we did in class that caluclates a 10% discount and modify it so it calculates the total. Now, I have to modify that into a VB sln file. then write about the differences but that part will be cake.

I am working in Visual Studio 2008 - that program is new to me as well. When I created my login and it asked what VB I'm using, I did not know but under theu of VS, it says VB 2008.hat I attempted to do was to take the instructor's sample discount code and modify it for the new purpose, but an error was generated. This is the sample code I started with:

'Programmer: Dan Dougherty
'Date: Feb 2010
'

[code].....

View 14 Replies


ADVERTISEMENT

Calculations Using Quantity And Price - Not Getting Right Value

Jun 3, 2011

I got a program I am working on. It does some calculations using quantity and price in such. Heres the calculation module.
Private Sub calculations()
If AdultsizeRadioButton1.Checked = True Then
adulttotaldecimal = quantityinteger * adultpricedecimal * hoursinteger
ElseIf ChildsizeRadioButton2.Checked = True Then
childtotaldecimal = quantityinteger * childpricedecimal * hoursinteger
[Code] .....

Ok, everything has worked when I display the information.... up until the accumprofitdecimal variable. When i display that value its NOT what it should be. For instance i'm putting in a quanity of 1 and an hour of 1 for an adult then for a child, the extended price comes out properly as $2.15 now the code accumprofitdecimal += extendedpricedecimal SHOULD add the extended price (2.15) to the accumulative total. but when i display the accum profit total it shows a number that makes zero sense... is accumprofitdecimal += extendedpricedecimal not correct code?

View 3 Replies

VB - Calculation - Multiply The Quantity Of An Item By The Price

Mar 12, 2012

I am struggling to write the code for a calculation. The calculation I wish to do is to multiply the quantity of an item by the price. The problem is that the "form" i am creating uses a letter (i.e A, B, C etc) which corresponds to a set value. I do not know how to link the Letter to the corresponding value.

For Example, A= 25, B= 20, C=25

I want to calculate the total of 6 lots of A. I am also using a Combo Box to list the Letters.

View 2 Replies

Translating Decompiled Code - Function That Accepts An Item Name Its Cost And Its Quantity

May 6, 2011

I was wondering if someone could translate this code into a more understandable code. It is suppose to be a function that accepts an item name its cost and its quantity. and adds one more array element to ."items" variable and assigns the given name and cost and quantity.

Public Sub AddItem(ByVal strName As String, ByVal dblCost As Double, ByVal intQuantity As Integer)
Me.items=DirectCast(Utils.CopyArray(DirectCast(Me.items,Array),New Purchase(me.itemsCount + 1)-1){}),Purchase())

End Sub

This is the translation i made but i don't think it is correct.

Public Sub AddItem(ByVal strName As String, ByVal dblPrice As Double, ByVal intQuan As Integer)
Dim items As Purchase() = Me.items
Dim itemCount As Integer = Me.itemsCount
For itemCount = 0 To items.Length - 1

[CODE]...

View 3 Replies

Combine And Add The Quantity,Price,Total Of Same Index In Listview?

Oct 9, 2011

Combine and Add the Quantity of same index in listview here's my Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If NumericUpDown1.Text = "" Then
MessageBox.Show("Please Input the Quantity!", "Sale", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
NumericUpDown1.Text = 1
End If

[Code]...

View 7 Replies

VS 2008 How To Calculate For A Retail Price

Mar 24, 2009

I have about 80% of this app done. All I need to do is convert what the user inputs of the wholesale cost of the item (lblCost and txtCost) and and convert that and the retail price to its markup %(lblMark and txtMark)

View 10 Replies

ByRef & ByVal Code - Program To Execute Properly - Can't Get Them To Add Up And Display The Quantity And Price

Apr 7, 2010

I started this tutorial on sub procedures and am having trouble trying to get this program to execute properly. The problem lies with the total. I am trying to figure out the math part of it. When I hit F5 I can see this

Item Quantity Price.

Pizza Slices
Fries
Soft Drinks

Total

But I can't get them to add up and display the quantity and price. I tried the ByVal and ByRef code but am not sure if I did it right

Here is the code that I have so far:

Public Class Form1

Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click

Dim pizza, fries, drinks, total As Double

[CODE]...

View 6 Replies

Class -program Where Enter The Description, Price, And Quantity Of An Item, Then Click On The Add Button

Aug 13, 2009

I have to create a program where you enter the description, price, and quantity of an item, then click on the Add button. It will then put the description, price, quantity, and total for that line (including tax) in a listbox. The tax is determined by what you put in a text box labeled tax:. When you press Submit Order, it should show a grand total in a text box called Grand Total. It should have a class that is called Items that has a function called GetTotalAmount() that figures out the total including tax. I have started it, but am having a tough time with how to get the subtotals into the text box, then also show the amount including the tax PLUS then do the grand total.

Heres what I have so far:

CODE:

View 3 Replies

Calculate The Quantity Of Each Item Sold?

Apr 16, 2011

how to calculate the quantity of each item sold?

View 9 Replies

VS 2008 Depreciation Loop - Calculate Straight-line Depreciation (cost * 1/n) N Being The Number Of Years To Depreciate

Jul 25, 2010

I have a program where I have to calculate straight-line depreciation (cost * 1/n) n being the number of years to depreciate, and Double-Declining depreciation (cost * 2/n) using user input for year of purchase, cost, and years of depreciation. The output needs to be put into 4 columns in a list box. Year, Value at beginning of year, Amount of depreciation during the year and Total depreciation to the end of the year.

The problem I am having is with my loop. It is not properly calculating. I'm sure I am doing something wrong that is simple, but I can't see it.

Here is my code; the problem areas are bold:

Public Class frmDepreciation

Dim Cost, Life, Year, Depreciation, BegValue, EndValue, Total, Counter As Double
Dim fmtStr As String = "{0,-10}{1,10}{2,17}{3,5}{4,-15}"
Dim fmtStr2 As String = "{0,-10}{1,10}{2,17}{3,15}"

[CODE]....

View 3 Replies

Cannot Calculate The Total When Quantity Variable Inserted?

Nov 8, 2011

When I enter the quantity variable the script will not calculate. What am I missing ?

Public Class frmMovie
Private Property intQuantity As Integer
Private Sub txtName_TextChanged(ByVal sender As System.Object, ByVal e As [codee]....

View 1 Replies

Calculate Cost From Elapsed Time?

May 27, 2010

I am trying to calculate a total cost from an elapsed time. Dependant on how long the time is, this will calculate the total cost. It has to be 3 to every hour. The elapsed time is displayed in label6 in "hh:MM:ss" format and the total cost needs to be displayed in label8.

View 4 Replies

Calculate The Total Cost Of A Parking Garage ?

Jun 21, 2010

I have a class assignment where i have to calculate the total cost of a parking garage from hours but i have to do it with a method function. So this might be a stupid question but can you read the user input values from a textbox in the function itself or do they have to be read in and recalled from the Private Sub Button1_Click section?

View 8 Replies

Calculate The Total Cost For Gas For A Chevy And A Buick On A Form?

Feb 19, 2012

I'm trying to calculate the total cost for gas for a Chevy and a Buick on a form. The total miles is 21 for city and 33 for freeway. I'm also putting in the mpg for each, for city and freeway. How would I set up the labels to display the right amount? Do I use If Then statements?

View 9 Replies

Program That Will Calculate The New Price?

May 4, 2010

I'm doing a program that will calculate the new price. Iv been using a class to put my code their. Iv been getting errors in my form code.

Heres the class code

Public Class Computer
Private _id As String
Private _price As Decimal

[Code].....

View 8 Replies

How To Calculate Total Price Of Fruit

Jan 8, 2010

The program is for calculating an amount of fruit. I have a label saying the name of the fruit, a textbox to enter a value of 0-99 and another textbox with ReadOnly which will show the price.

A little picture here:[URL]

As you can see, the Fruit1 Etc... Is only the fruit name.
The Text box wich indicate 1-99 means the number of fruit.
The Textbox with Cash on it, means the total price.
The Calculate button, when I will push it, all the total price from all the fruit will be added together to form a total price which will be indicated in the total price textbox under the Calculate button.

When I will enter the number of fruit, if I enter 99, it give me a price.
When I will enter 60, I want that the 60 are multiplied by (let say) 0,10$
I just like to know how I can do this... Its really bothering e and I don't want to calculate all the things and make 99 line for 1 fruit cause it will be long.

The code I was using was:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = "99" Then
TextBox2.text = "10.00$"
Elseif TextBox1.Text = "98" Then
TextBox2.Text = "9,90$"
EndIf
End Sub

Until the the number of the fruit in the code reach 0. So its very long.

View 14 Replies

Computing Cost - Cost Is Displayed Instead Of An Accurate Cost ?

Sep 17, 2010

I am running into trouble with some code I am doing for an assignment. The section within the apostrophes (If Then Else) is the section that I am having trouble with. When the user selects a seat type and then clicks the compute button, the wrong cost is displayed instead of an accurate cost.

Option Strict On
Public Class frmTickets

Private Sub btnComputeCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnComputeCost.Click
Dim intNumberOfTickets As Integer

[CODE]....................

View 6 Replies

VS 2010 Calculate Price From Datagrid To Textbox?

May 22, 2011

I Have a datagrid with Item, Description of Item, Qty and Price.I would like on the 1st txtbox display subtotal depending on the quantity, price and add a tax textbox and the subtotal all from the datagrid to to those textboxes.

I already have all of that on my table of Products.

View 2 Replies

Sub Procedures - Pizza Vendor - Display An Itemized Bill - Calculate The Total Cost

Oct 27, 2009

This is my project for class and this is what i have so far but my teacher gave me no credit. What am i doing wrong? i tried rearranging it but no success.

A fast-food vendor sells pizza slices at $1.25 each, fries at $1.00, and soft drinks at $0.75. Write a program to computer a customers bill. The program should use 4 subprocedures that do the following:

1. read in the amount of each item ordered

2. calculate the total cost

3. display an itemized bill

4. read in the users full name from a textbox, and display a sentence, addressing the user by first name only and in upper case characters, informing the user of their bill

Here is an example itemized bill:
Item Quantity Price
Pizza slices 3 $1.25
Fries 4 $1
Soft drinks 5 $0.75
Total $11.50

Example sentence for point 4: if the user name was entered as John Smith, you would display the sentence JOHN, your bill is $11.50.

MY

Public Class Form1

Sub pizza(ByVal pizzap As Double, ByVal pizzanum As Double)
lstoutput.Items.Add("Pizza Slices" & pizzap & "and" & pizzanum & "is" & (pizzap * pizzanum) & ".")

[CODE]....

View 6 Replies

Reciept Printing - Form Which Consist - Item Code , Item Name , Item Price , Quantity Of Item

May 25, 2012

Regarding my college project. i'm working on a sales system . i have a form which consist of all the following information( item code , item name , item price , quantity of item ) which is display using a data grid . data input by user using text box and all this information will be stored in a database(sales database) i'm using ms access 2007. the grand total will be displayed in a text box . and amount paid will be input in a text box too , my major problem now is how to i create a reciept that will have all this information of the purcase. i have a reciept button . what the next step ? i dont have any idea how to get the reciept done.

Imports System.Data.OleDb

Public Class Form5
Dim con As New OleDbConnection

[CODE].......................

View 9 Replies

User Selects From Multiple Listboxes To Get A Price From A Price Array

Nov 25, 2011

I am new to vb and I am having so much trouble with this. What I need to do is this: I have a form application for winter sports equipment rental.I have a listbox filled with the equipment for the user to choose from then I have a combobox for the user to select the duration they would like to rent it. The book that I am using has no examples I can refrence and i have had no luck online either. I am posting what I have so far. However, i think I am going in the wrong direction. I have been working on this for so long that I think I have over thought it and made a mess of it. I am thinking that I need to add a new class for rentalRates then use enum of durationType and equipmentType but I am unsure how to move that way. That is using a enum, a 2d array and a parallel array? [code]

View 1 Replies

Get The Price Of The Premium Or Regular In Price Per Unite?

Jan 24, 2012

PHP

Public Class GasPump
Private name As String
Private quan As Double

[Code].....

I get problem in the code when you going to pick y/n. how i going to get the price of the premium or Regular in Price per unite?

View 7 Replies

VB 2010 Validation - Form As Follows "Price Changer" - User Is Allowed To Select A Product And Enter Price

Apr 17, 2012

I have a form as follows "Price changer" The user is allowed to select a product and enter price . So when the change price button is clicked...the price is stored in a array which is later called

So what i am stuck is when the user selects a product from the drop down menu...the user can enter price . But i need to display a error message when the user enters text instead of numbers for prices. I tried try parse method but it displayed the error message but did not transfer the entered price to the array.

My code is as follows

The bolded intMediaprice() are arrays....

Private Sub btnPrice_Click(sender As System.Object, e As System.EventArgs) Handles btnPrice.Click
If cbMedia.Text = "8-Track" Then

[CODE]...

View 3 Replies

Code Total Cost To Give Pound Sign With Total Cost At Moment When Total Comes Up

Jun 7, 2010

How do I code the total cost to give me a pound sign with the total cost at the moment when the total comes up for an example it gives me 3.6 when I need it to show £3.60 here is the code I have so far. [code]

View 2 Replies

Enter The Price In A Text Box And Click The Enter Button To Send The Price To A List?

Nov 15, 2011

I have to create a form that I enter the price of gas each month over a year. I enter the price in a text box and click the enter button to send the price to a list box immediatley and use an array. I have the following code but I don't think it's working with the array correctly as it will let me enter the information but doesn't stop letting me enter after the 12 prices. I am really having a hard time trying to figure out how to set up this input for an array and make it all work.

[Code]...

View 1 Replies

VS 2008 Calculating Cost In Project?

Mar 7, 2010

My project, is something that could be used by an opticians (well in theory anyway)I have a customer being selected, eye measurements etc..Then I can enter in data (into textboxes):

TextBox1. Frames Stock: #12345
TextBox2. Material Used: Glass / Plastic
TextBox3. UV Filter: Yes / No

[code].....

View 6 Replies

VS 2008 Cost Calculator Errors

Apr 17, 2010

I was trying to make a calculator which takes the amont of copies you want to make and it tells you the cost. Then you type in the amount you want to enter and if its less a message box comes up saying "please enter more money". I've had a few problems

1. when i use formatcurrency the program crashes for no apparent reason

2. if i calculate cost without entering any copies then it crashes (ive tried putting a msgbox in but it crashes anyway)

3. if i get the msgbox to come up saying "Please enter more money" i had to remove the formatcorrency tag.

View 9 Replies

VS 2008 Code To Work Out Cost With Different Prices Per Mile?

Mar 2, 2011

For our programming assignment to end the module (which im really struggling with) we have to write some code for use in a fictional taxi firm that charges �2 for the first mile, one price for miles 2-10, and another for all miles thereafter.

View 11 Replies

VS 2008 Checkbox Price Add To The Total?

Oct 28, 2010

I have a form with check boxes and behind the check box i assigned it to a const Price. I have a Total Label box and I want to check to check boxes and add them to the total label

View 1 Replies

VS 2008 Read / Display Data Name & Price

Apr 11, 2010

As a continuation of my eCommerce app, im trying to display the name of DVD's + their price into a ListBox All the data is being read from a text file which stores the dvdname and the price e.g

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved