Shopping Cart App In VB Using Arrays?

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


ADVERTISEMENT

.net - ASP.NET Shopping Cart?

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

Shopping Cart Gridview

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

Add Running Total To Shopping Cart?

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

Create A Shopping Cart Application?

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

Application Like A Shopping Cart - Global Variable?

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

Placing Items From Listbox To Shopping Cart?

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

.Net Shopping Cart Session Accessible Across Different Browsers By Different Users?

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

Attempting To Create Shopping Cart Remove Button?

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

ASP.NET Populate Gridview Textfields With Values From Session Shopping Cart

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

Shopping Cart Sending Data From Listbox To Another On A Diferent Form

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

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

Clicking On ADD TO CART Using Webbrowser?

Feb 26, 2012

For the past couple weeks I've been tormented by this problem: I am trying to make a program that will go to a specific web site and add things to my cart on that page. I can get the program to go to the page, log into my account, and get to the right product. But, I can't figure out how to click on the ADD TO CART image.

Also, each product page has the main product, with an ADD TO CART image, and at other places on the screen there are other products shown, each with its own ADD TO CART image.I have been examining the source for the pages and here are a couple examples:

[Code]...

How can I click on one of those addToCart.gif images? It looks like they do not have names or IDs for me to refer to them with?

View 2 Replies

Remove Items From Cart?

Apr 7, 2011

I have create a shopping cart in vb.net, so far i can add items to cart but cant empty or remove items from cart. this is the code I have so far:-

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<div id="mycart">
<br />

[code]....

View 1 Replies

Asp.net - Count The Number Of Items In Cart?

Jun 12, 2011

i am developing an online shopping site..so when the user adds any item to the cart i store it in a table...now what i want is to count the number of items in the cart as well as update the number of items in cart every time the user adds a new item....

Public Function AddToCart(ByVal itemID As String, ByVal itemName As String, ByVal itemPrice As Integer, _
ByVal offer As String, ByVal buyNo As String, ByVal userID As String) As String
Dim sqlStatement As String = "INSERT INTO shoppingCart" & _

[code].....

View 1 Replies

Get Items To Show Up In Shopping Card But Nothing Shows Up?

Nov 11, 2011

I'm trying to get my items to show up in my shopping card but nothing shows up

View 4 Replies

Save The User's Recipes - Shopping Lists And Menus?

Mar 28, 2009

I am in the process of developing a Recipe Manager for myself. It will allow me or the user to add and manage their recipes, create, save, and print shopping lists and daily menus. My question is, what is the best way to save the user's recipes, shopping lists, and menus? I've thought of text files, and databases but they just don't seem right for the job.

View 1 Replies

Shopping System - Selecting Print Or Audio Books

Jan 25, 2012

The user can select from either print or audio books and add to the shopping cart. The list box shows all items in the shopping cart. There is a 6%. sales tax on the total cost of the items in the shopping cart and a 2 dollars shipping charge per item in the shopping cart. to remove an item from the shopping cart, the user selects it in the list box and clicks the remove button. the subtotal, tax, shipping, an total fields should be adjusted accordingly.

To add one of the items in the list to the shopping cart, the user selects it and clicks the add book to cart button. to cancel the operation, the user clicks the cancel button. I am using a standard module to declare global variables. My file is attach I have the problem that everytime I add a new item, it will just add 2 and then I add another item and it add 2 it does not show the subtotal or the tax and shipping and the real total....

Module PriceCalcModule
'constants for Print
Public Const g_decDID_YOU_KNOW As Decimal = 11.95
Public Const g_decHISTORY_SCOTLAND As Decimal = 14.5
Public Const g_decLEARN_CALC As Decimal = 29.95
Public Const g_decFEEL_STRESS As Decimal = 18.5
[Code] .....

View 4 Replies

VB6 Used Recordsetsor Arrays - .Net Framework In VB2010. Datasets, Dataviews. Tableadapters, Arrays. Enums ?

May 9, 2010

In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.

The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?

View 3 Replies

Integer Arrays - User Enter In Big Integers Using - Two Parallel Arrays

Dec 10, 2009

My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.

'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays

[CODE]...

View 5 Replies

Passing Arrays Through Fortran Dll From App Turning To Single Element Arrays?

Feb 2, 2010

I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working

View 1 Replies

VS 2008 Arrays Displaying States/searching Arrays?

Oct 30, 2010

the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "

Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"

[code]....

View 1 Replies

Comparing Arrays :: Possible Without Iterating The Arrays?

May 3, 2010

I was wondering if anyone knows a built in method ( LINQ say or a LAMBDA expression or other way ) that you can compare2 arrays - collections that would be valid for an equivalent 3rd array - collection which is a combination of the 1st two.

As an example consider;
* * *
A L E

[code].....

View 17 Replies

Sort Three Arrays (the Other Two Arrays Are In Sync With The First)?

Oct 13, 2009

How can I sort three arrays so they are sorted together (the other two arrays are in sync with the first)?unsorted unsorted unsortedarray1]CODE]....

View 9 Replies

VS 2008 HttpWebRequest Add Item To Cart Then "post" To Change Quantity

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

Class With Dynamic Arrays Inside Another Class Which Also Has Dynamic Arrays?

Nov 15, 2011

Below you will find a code sample that I have dummied up to try and demonstrate the issue I am having. However, this is just a dummied up piece of code. The actual program has noting to do with STUDENTS or TEACHERS. Basically, the problem I'm having is trying to have a CLASS within another CLASS each of which contain ARRAYS that need to be dynamic in size. The sample has a CLASS called STUDENTS that can have in theory many students, the number of which are unknown to the CLASS. I need to be able to add STUDENTS to the ARRAY programmatically.

The CLASSROOM Class should also be an Array since each TEACHER will have MANY Students. There will be only 1 Teacher for a given classroom but the SCHOOL will have MANY CLASSROOMS. Again, I need to programmatically add Teachers and Students without having predefined Array sizes. The code I have listed below will NOT work but it demonstrates what I am trying to achieve. I want to be able to reference the CLASS by using something like this ...

School(iTeacherIndex).Student(iStudentIndex) = "Rick Smith"

I feel like I should be able to use ARRAYLIST in both classes but haven't been able to get it to work. I've tried DIM'ing as ARRAY and can't get that to work either.If I can get ARRAYLIST to work then I shouldn't need to worry about expanding the array via UBOUND (if it's even possible).The REAL question is "How do I have a CLASS within a CLASS, each of which has ARRAYS that need to be dynamic in nature so they can be expanded as needed? The size of the array cannot be determined ahead of time".

REMEMBER . . . the actual program has nothing to do with Students and Teachers. This was just my way of demonstrating the issue using an analogy that I thought everyone could understand. The actual Class is much more involved.I have purposely hardcoded some values just to make the sample easier to work with. This is NOT how I normally program but is just here to hopefully make things a little more clear.

Here is the sample code . . .
'***********************************************************************************
'***********************************************************************************
'***********************************************************************************

'Here is the code that is in the form - This obviously doesn't work

Private Sub TeacherTestDemo()
Dim iTeacherIndex As Byte
Dim iStudentIndex As Byte

[code]....

View 2 Replies

.net - Using Arrays With Asp.net And VB?

Oct 31, 2011

Sorry, I'm sure this is something that has been covered many times, but I can't find quite what I am after.

I have a single row data table which contains various settings which are used within my web system. I have been toying with turning this into an XML document instead of the single row datatable, would that make more sense?Anyway, so, given that this is one record, there is a field called "locations," this field contains data as follows:

locationName1,IpAddress|locationName2,IpAddress|etc

The ipAddress is just the first 5 digits of the IP and allows me to ensure that logins to certain elements (admin section managed by staff) can only be accepted when connected from a company computer (ie using our ISP) - this is a largely unnecessary feature, but stops kids I employ logging in at home and stuff!

So, as the user logs in, I can check if the IP is valid by a simple SQL query.

SELECT ips FROM settings WHERE loginLocations LIKE '%" & Left(ipAddress, 5) & " %'

What I need to be able to do now, is get the name of the users location from the dataField array.

I've come up with a few long winded looping procedures, but is there a simple way to analyse

locationName1,IpAddress1|locationName2,IpAddress2|etc

as a string and simply get the locationName where LoginIp = IpAddressX or am I going about this in a totally ridiculous way and should turn it into an xml file? (which will then create a whole load of other questions for you about parsing XML!!)

View 4 Replies

Need Some Example Of Use Of Arrays

Aug 28, 2009

Arrays in Visual Basic When you use arrays, you can refer to multiple values by the same name, using a number called an index or subscript to distinguish them from one another. Arrays can shorten and simplify your code, allowing you to create loops that deal efficiently with any number of elements.How to Use Arrays, Why We need it to use.

View 1 Replies

Arrays - Create New T[] In .NET?

May 28, 2011

How can I do the same as the following in VB.NET

List<T[]> result = new List<T[]>();
// single combination
if (k == 0)
{

result.Add(new T[0]); // T is function type argument of generic function How can I write the last line above in VB.NET?

I tried:

result.Add(New T(0)) 'doesn't work!

View 2 Replies

Asp.net - 2 Arrays To Serialize?

Jun 23, 2011

I have the following code which works well:

Dim dept As New ArrayList
Dim forename As New ArrayList
objJSONStringBuilder = New StringBuilder()

[Code].....

Eventually, I will want to add more columns, i.e. surname.

View 2 Replies







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