Getting Program To Automatically Calculate The Subtotal Every Time An Item Is Added To The Shopping Cart List
May 1, 2012
I am working on a project for a class, and am having trouble getting my program to automatically calculate the subtotal every time an item is added to the shopping cart list. I've tried sub procedures and functions, but I can't seem to get it to work.
[Code]...
View 4 Replies
ADVERTISEMENT
Feb 7, 2011
I am in the middle of building a very simple shopping cart in asp.net with a VB backend but I am running into problems with my code. When I run my application and try to add a product to the cart I get an error message.
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 27: Dim blnMatch As Boolean = False
Line 28:
Line 29: For Each Me.objDR In objDT.Rows
Line 30: If objDR("StockItemName") = Product Then
Line 31: objDR("Quantity") += txtQuantity.Text
I am not sure why it is doing this and was hoping that perhaps someone could take a look and offer up some advice? I have checked over my code and I cannot find anything wrong however I would take any guidence that you may have on it.
[Code]...
View 1 Replies
Mar 3, 2008
I am trying to create a shopping cart in Visual Basic. I have most of it figured out. However, when I click the Add Cart button, the item will add; however, when I add a new item, it will not go to the next line to display it. It instead replaces the first item I added. For example if the user chooses 1111 for the part number and qty is 2 then clicks the Add to Cart button, the following will show in a group box below: 1111 Alarm Clock 2 $19.95 $39.90
If the person wants to add part number 2222 and qty is 2, that relating info should show up below the first entry of the Alarm clock. In my code, it's not doing that, it's just replacing the first line (alarm clock entry). However, it is keeping track of the total amount added to the cart.
Here is my code that I have done for the Add Cart button:
Private Sub xAddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xAddButton.Click
Dim searchFor As String
[Code]......
View 4 Replies
Jul 28, 2011
I am building a shop (without payment)
i.e.
1) Select Products
2) Checkout
3) Confirmation
The selecting products screen will look like a gridview which will display.
name price quantity
Text Text Input box
So i.e. lets say I have 10 products per page so i.e. 10 quantity input boxes per gridview. And then I have 2 Buttons below my gridview i.e. Update and Checkout. Just even worrying about Update for now. How could that work i.e. would I have to check every input box in gridview for which a value was entered ?
I.e. is there any example how I can loop through gridview row check for a value which is greater than 0 or null for example and if there is a value then perform a function like [Code]
View 2 Replies
Dec 4, 2011
I've created a program that pulls item prices from a database. The problem I'm having right now is that I'd like to display a running total, as the program currently only displays the list of items and their prices.
Private Sub btnGoToCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoCart.Click
Me.Hide()
[Code].....
View 1 Replies
Apr 30, 2010
I am working on a class project and I am trying to create a shopping cart application. I need to transfer info from listboxes on 2 forms to the main form and calculate the charges for "the books." I am having a hard time writing the code to properly transfer the items and I really have no idea where to start with the calculating the charges for subtotals of the selected books.
View 3 Replies
Dec 27, 2011
My project is to create a shopping cart application. I have my main form and from there the user can go to two different forms to add books to their cart, the cart being the main form. This all works. What I can't figure out, is how to use global variables for the prices, shipping, tax and updating the total. I have places for this information to show up on the main form, and I've created a module for the calculations and prices, but I don't know how to code it to get the prices to show up in the specified areas.
View 3 Replies
Nov 14, 2011
How can I get the items in my code from my listbox which is called "selectListBox" to a shopping cart called "cartlistbox", when the add button is clicked?
Public Class MainForm
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
[Code].....
View 5 Replies
Dec 1, 2011
Using following method to create Shopping Cart Session [URL]Now running locally on my machine where sessionstate mode is inProc by default, all seems to perform fine.I'm writing an application which I've just placed up on hosting provider (shared hosting environment etc). Their default sessionstate is stateserver so I had to serialise the classes to fit in with this. It's using cookies.The basket (adding,removing etc) works fine but I'm seeing some odd things happen regarding the persistency of the session.
On my local machine, if I access the site in 2 separate browsers, if I add items in IE, I can see them in Firefox when I refresh. This doesn't make any sense to me since cookies are per browser.Plus I thought that when a session was generated, its id would be unique so there is no way that one user should be able to see anothers session data (unless tabbed in same browser perhaps)Even worse, if I start adding/removing items in IE and doing likewise in Firefox, both of them show very random cart results every time you refresh the browser.
View 1 Replies
Mar 20, 2012
Note: This code actually codes from a tutorial book I'm reading at the moment, so you can imagine this is frustrating me greatly! I'm building a basic shopping cart, using VB.NET 4, Visual Studio 2010 and MS SQL Server R2 2008. The code below is supposed to remove items from the cart, by reading a session variable, editing it to remove the appropriate ProductID and return the amending string to the session variable. It is then supposed to rebind the data to the gridview (gvCart) to refresh the data...but it seems here there is an error.
Every time I build the site in Visual Studio, it validates fine. But every time I run the site, and attempt to use the remove button it gives me the error:Incorrect syntax near ')'.ith the IDE pointing me toward the final parenthesis
Protected Sub gvCart_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvCart.SelectedIndexChanged
'This method is hooked to the Remove button & is removing items from the cart
[code].....
View 1 Replies
Aug 5, 2011
I have a gridview as follows
<asp:GridView ID="productListTable" runat="server" DataSourceID="srcProductListPerCustomer" AutoGenerateColumns="False" AlternatingRowStyle-CssClass="tr_dark" HeaderStyle-CssClass="header_req"
[Code]....
And it actually seems to work on first instance (altho im not sure the above is a good way to do it, but the problem is when use the pagination on the gridview I get the error
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
On the line
Dim productId As String = productListTable.DataKeys(i).Value
why I am getting this error and also is there a better way to do it ?
View 1 Replies
Apr 26, 2012
i havent had problems in visual basic all the ay up to this point. I have been given a shopping cart program that I must use: a MainForm, MP3From, AlbumForm, and a module
I finally got my program to send data from the listbox on my MP3Form to the listbox on my MainForm but something isnt right still. I need to be able to click an an item from the lstMP3(listbox on MP3Form) to lstShoppingCart(listbox on MainForm) multiple times without having to close the MP3Form everytime to add the items to lstShoppingCart. Here is what I got so far on my MainForm:
[code...]
This assignment makes me mad cause we have not even covered half the stuff I am having to use in this form at all this semester. If i can get a little explanation on instantiate, inheritance, and declaring and object variable and how its used to transfer data from one to the other.
View 3 Replies
Mar 13, 2012
I'm having a problem with a MySQL query for returning the "last visit" field in a table.Originally I had:select fname, lname, last_visit from patient where isactive = 1 and uid = 1Which worked perfectly in MySQL, but as soon as the query is executed by my ASP.NET app, it adds in the time field also to the date area. So 2011-12-12 becomes 12/12/2011 12:00:00 AMI tried this also, with no improvement:
View 2 Replies
Jun 22, 2010
The idea with this form is to add the futures which is calculated when the button is pushed but I need the list to update every time and show the values each time to which the previous value is added to the new calculation, e.g. of what it should look like in listbox:
Year 1: $1,290.93
Year 2: $2,724.32
Year 3: $4,350.76
etc....
I have been working on this a while and I am at a standstill, I was given a function to clear the form everytime it calculates but I don't know how to implement it, I am new to VB. Here is what I have so far:
Public Class frmFutureValue
Private Sub btnCalculate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
[code]....
View 7 Replies
Jun 9, 2011
i am using vb.net 2005 and i want to know the event name for a listview that happens every time an item is added.
View 1 Replies
Jun 11, 2010
I have two datagridviews in my app. They're related. When there is no record in the parent datagridview, I select the "New Row" and then press the Add Button in the child datagridview's bindingnavigator. Then I get that exception:
InvalidOperationException: Item cannot be added to a read-only or fixed-size list.
I know why this happens.When I add new record to child datagridview, parent datagridview's new row loses focus and then delete row. So this error occures.How do I prevent my program from this exception. Remember, it's only occures if there is no record in the parent datagridview.
View 1 Replies
Oct 27, 2010
I'm writing code some that is supposed to be creating a list of objects pulled from a data base. The list returned has every item containing the value of the last one added. When I debug the code is VS2008 I can see each time that the list.add is performed every other item in the list being changed to the one just added. Here is the code I running. The line containing ListAKAs.Add(itemAKA) is the one where the entire list of objects is changed to be identical to the one just added.[code]....
View 1 Replies
May 9, 2012
If I set the capacity of a List(of T) and then want to add more item will it expand automatically or will I get an Out of Bounds error?Any source of information about List(of T) out there that I can check?I am writing an application that gets a text file read into a List(of T) and then searched by the user
View 10 Replies
Jun 29, 2012
I'm having trouble removing both the number of adult golfers and children golfers in a group. I want to remove the item as well as update the order subtotal.
The Minigolf form code
Dim intTotalGolfers As Integer = 0
If IsNumeric(txtNumberOfAdults.Text) Then
If CInt(txtNumberOfAdults.Text) >= 0 Then
[Code]....
View 14 Replies
Sep 9, 2009
In a VB.Net application, how can I either: Find the dropDownList selectedIndex position of something just added to a database.Have a form restart with the most recently-added entry showing in the DropDownList, by way of modifying the inline SQL query to display by date/time added
View 3 Replies
Jul 5, 2010
In my application I have a listbox and SelectionMode should be MultiSimple because users need to see which items they selected. In another tab we have another listbox this one should show all the selection users had done in first tab. Private Sub
[Code]....
View 3 Replies
Feb 18, 2012
I am creating a program for which will calculate the time taken for a user to make a number keystrokes. I want to start the timer running from the beginning of the first key stroke and end on the final keystroke. Each keystroke has been linked to a label which will change colour according to whether the key has been pressed. When the keystrokes have been finished I want to save this timespan in a field in a database. To test that the timer is running I have made a messagebox which will show the time taken however it is constantly showing zero and the label for the final keystroke is remaining in the keydown colour.
Public Class Form1
Dim dteStart, dteFinish As Date
Dim span As TimeSpan
[code]....
View 19 Replies
Sep 8, 2010
I'm trying to create an import program from CSV. My code is
[Code]...
View 2 Replies
Jan 28, 2011
Im using visual basic 2010 and im building a program that will basically, you click on something in the list it will automatically open a .dat file pull the information that it needs, and then proceed to enter it into a box on the right. Well heres my issue i know how to do everything else but i cant seem to imitate this image, i need to know how i can make a list like this where the whole row is selectable, and the items/subitems are divided.
View 9 Replies
Feb 10, 2012
i have problem on use HttpWebRequest with "POST" method.First, I access this link [URL] and go to the cart page.Then when I change the quantity to 2, I had see the live http header to use "POST" and submit the content to the server.I follow the header and write with vb2008, but I get the server return 503 error on the code that getting response,?
Here is my
Dim logincookie As CookieContainer
Dim response As HttpWebResponse
Dim tempCookies As New Cookie
Dim req As HttpWebRequest
[code]....
View 4 Replies
May 27, 2012
I have a program that will compare an array of grocery list items glist and an array of coupon item clist.When I compare the two and if there is a match somewhere in the array I want to have a picturebox visible.When there is no match, I want the picture box not to be visible. [code] The code seems to work great until I come to the else statement.When the code finds a match it displays the picture box and the msgbox without error, but as soon as the message box is cleared, even though i've input it as an ELSE statement, the picturebox goes false again.Does anyone have any idea of how I can "hold" the picturebox to stay visible while the match between the arrays exists?
View 18 Replies
Nov 23, 2011
I am constructing a program, i am new to Visual Basic, but i have past programming experience. I was wondering if anyone knew how to form a loop that could...lets say calculate the answer when two numbers are added together,and it would repeat this thousands of times, etc. And if there is a way, would it be possible to calculate the time taken to complete this loop.
View 5 Replies
Mar 10, 2012
I have two tables: HolidayRequests & HolidayEntitlementWithin the Holiday Requests I have 1 field:DaysWhen a staff member adds a holiday request it is stored as a number in the holiday requests table in days field (there are multiple requests with different days)
View 2 Replies
Sep 10, 2011
When new record is added, I want the vb to look at the last record in the database, look at its id, add 1 to it (+1) and generate a new number and display it in the IDTextBox.
View 5 Replies
Jan 1, 2012
I have a list box on the form which functions as a copy/paste. When you copy something, it is automatically added to the list box as a "clipboard helper". Here is the problem,however: if the text is more than 1 line, the list box does not show all the text.It ends up looking messy.So getting back to my question, is it possible to make the list box item height for an item depending on the amount of lines that item contains?This is a one line sentence in the list box and should take up one line.This is a multi line sentence in the list box and should take up two lines for item height.
View 11 Replies