473,383 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

error when commiting the row to the original data store(urgent)

i am having this error when i am about to delete a data row

inline with this is a message box saying:
object reference not set to an instance of an object. do you want to correct the value?

if i click yes, it will delete the row if no it will ignore the deletion

i've already checked all of my declarations and pretty sure that i've declared everything right. please help me about this. thanx!
Jul 10 '07 #1
4 1222
Killer42
8,435 Expert 8TB
A "data row" in what? And using what version of VB?
Jul 10 '07 #2
sorry for the late response.

here's my code:

Private Sub delCol_ButtonColumnClick(ByVal sender As Object, ByVal e As Leadit.ExtendedDataGrid.ButtonColumnEventArgs) Handles delCol.ButtonColumnClick
Dim row As Integer
Dim hourdiffBtn As Integer
Dim sBtn As DateTime
Dim eBtn As DateTime
Dim res As MsgBoxResult
row = Me.dtgCustomSched.CurrentRowIndex
res = MsgBox("Are you sure you want to delete the schedule on " + Me.dtgCustomSched.Item(row, 0), MsgBoxStyle.YesNo)
If res = MsgBoxResult.Yes Then
sBtn = Date.Parse(Me.dtgCustomSched.Item(row, 1))
eBtn = Date.Parse(Me.dtgCustomSched.Item(row, 2))
hourdiffBtn = getHrValue(sBtn, eBtn)
lastRowNumber = lastRowNumber - 1
Me.remainingHour2 = Me.remainingHour2 + hourdiffBtn
Me.txtLookUpHours.Text = remainingHour2.ToString
addSchedule.Table("ttcpcustomizedschedule").Rows.R emoveAt(row)

Else
Exit Sub
End If
End Sub


dtgcustomsched is the name of my datagrid
addsched is the name of the dataset

i made one of the datagrid cell as a customized button.. it already work fine with my other codes.. the problem only occur here

the error occurs on the line in bold.

also, this error only appears when i delete the last row on the datagrid, but if i delete anything rather than the last row everything works fine and no error is being detected

please help. thanx!

i am using vb.net 2002
Jul 11 '07 #3
Motoma
3,237 Expert 2GB
also, this error only appears when i delete the last row on the datagrid, but if i delete anything rather than the last row everything works fine and no error is being detected
Not knowing anything about VB.NET (other than the .NET framework) it sounds like you have an indexing issue. That is to say, you are trying to remove a row outside the boundaries of the dataset. Try deleting the first row. Does the proper row get removed, or are you off by one?
Jul 11 '07 #4
Are the two indexes zero-based

row = Me.dtgCustomSched.CurrentRowIndex
.
.
.
addSchedule.Table("ttcpcustomizedschedule").Rows.R emoveAt(row)

If they have different bases, then you might need to do the following :

row = Me.dtgCustomSched.CurrentRowIndex - 1

Or

addSchedule.Table("ttcpcustomizedschedule").Rows.R emoveAt(row + 1)
Jul 12 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paul | last post by:
Hi: I am not sure whether somebody can sort it out for me. I am doing data transfer from one oracle database to another. Both of them has the same structure (like same tables etc).the only...
0
by: raj | last post by:
I had a simple .NET application successfully developed and deployed to a production environment. Out client required another application, which is slightly different from the first application....
4
by: Imran | last post by:
Hello All Am trying to read a huge txt file and write to a file back. pls see the code int main() { char* pData;
1
by: far_asllam | last post by:
When i try to upload my project which is using a pdf generator assembly. It gives me Error as: Configuration Error Description: An error occurred during the processing of a configuration file...
10
by: Teja | last post by:
HI all, I have a problem in accesing COM objects in threads. To be precise, lets assume that I have a class GenericFunctions which is defined as follows: import win32com.client, pythoncom,...
5
by: igotyourdotnet | last post by:
I'm creating a web service this is going to return an arraylist of items. When I try and run it Im' getting the following error message: System.InvalidOperationException: There was an error...
4
by: ashasivan | last post by:
Hi, Please help me as soon as possible for the following problem. It is very very urgent. I have an XML file as follows: <?xml version="1.0" standalone="yes"?> <Employee> <em...
3
by: jats | last post by:
I am a .NET programmer and i had recently got a web application designed in Classic ASP, to make some modifications. When i run the application and try to create a new user the following error...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.