- Joined
- Apr 2, 2008
- Messages
- 1
- Reaction score
- 0
DISCLAIMER: this is all for a lab in school that is designed for us to have to do things as difficult and as wrong as possible (dont ask)
i've got a grid view that is loaded with data from an sql query
i have check boxes in the grid for removal of certain items (its a shopping cart)
the remove functions fine but if i remove everything the add item stops working
i have two diff attampts for the same thing that get two diff exceptions
the exception is in asterix
aRow = Cart.Tables("CartTable").NewRow '*****object reference not set to instance of object *******
and
aRow = Cart.Tables(0).NewRow '*****throws exception, cannot find table at 0 *******
my fix for this was to add a check at the end of my remove to see if .tables(0) or CartTable was empty and if so insert a blank row.
i thought i was almost good to go, i added a method to remove the blank row after a real row has been added, but discoverd that when i run the program the first time it crashes on the check to see if it needs to remove the blank row
Dim gRow As GridViewRow = dgvSale.Rows(0) '******throws index out of range exception********
my fix for that was to use a global variable as a check value, but soon realized that there is no global variables in web apps (well its always getting reset)
so my fix for that was to force a blank row on startup then remove it when somthing is added, but my track record for fixes isnt very promising
anyone kno of a better way?
oh yeah the dataset is being saved in a cookie, so if anyone thinks i should remove the blank row or do w/e with it that way lemme know what to do and how to do it, im a total noob when it comes to cookies. i can make em work but dunno how
srry about length
i've got a grid view that is loaded with data from an sql query
i have check boxes in the grid for removal of certain items (its a shopping cart)
the remove functions fine but if i remove everything the add item stops working
i have two diff attampts for the same thing that get two diff exceptions
the exception is in asterix
aRow = Cart.Tables("CartTable").NewRow '*****object reference not set to instance of object *******
and
aRow = Cart.Tables(0).NewRow '*****throws exception, cannot find table at 0 *******
my fix for this was to add a check at the end of my remove to see if .tables(0) or CartTable was empty and if so insert a blank row.
i thought i was almost good to go, i added a method to remove the blank row after a real row has been added, but discoverd that when i run the program the first time it crashes on the check to see if it needs to remove the blank row
Dim gRow As GridViewRow = dgvSale.Rows(0) '******throws index out of range exception********
my fix for that was to use a global variable as a check value, but soon realized that there is no global variables in web apps (well its always getting reset)
so my fix for that was to force a blank row on startup then remove it when somthing is added, but my track record for fixes isnt very promising
anyone kno of a better way?
oh yeah the dataset is being saved in a cookie, so if anyone thinks i should remove the blank row or do w/e with it that way lemme know what to do and how to do it, im a total noob when it comes to cookies. i can make em work but dunno how
srry about length
Last edited: