473,320 Members | 2,054 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,320 software developers and data experts.

datagrid crashes program when loading on the fly

here are the lines of code that I've tried. All crash the program

shownVals is a string array
data is my datatable

//problem code #1

loop here{
((Form1)NewsMyWay.Form1.ActiveForm).data.Rows.Add( shownVals);
}

//problem code #2

((Form1)NewsMyWay.Form1.ActiveForm).data.BeginLoad Data();

loop here{

((Form1)NewsMyWay.Form1.ActiveForm).data.LoadDataR ow(shownVals,false);

}

((Form1)NewsMyWay.Form1.ActiveForm).data.EndLoadDa ta();

//problem code #3

loop here{
((Form1)NewsMyWay.Form1.ActiveForm).data.BeginLoad Data();
((Form1)NewsMyWay.Form1.ActiveForm).data.LoadDataR ow(shownVals,false);
((Form1)NewsMyWay.Form1.ActiveForm).data.EndLoadDa ta();
}

I'm pulling data from the internet and trying to put it into my
dataGrid on the fly but I always recieve a

System.NullReferenceException

when the grid is populating or a few seconds after it has finished.
I've also tried to throw in

((Form1)NewsMyWay.Form1.ActiveForm).data.AcceptCha nges();

in various spots in my code but that does nothing. When I save the
downloaded data to a txt file I can import the data to the grid fine.
Unless there is too much data, that also causes a crash but is another
issue. I'm at a loss :/
Any suggestions are much appreciated. Thank you

Nov 15 '05 #1
1 1393
You use a "working" thread to load the data in the dataset?

Try to use the following piece of code:

Form1 f=(Form1)NewsMyWay.Form1.ActiveForm;
f.Invoke(f.data.Rows.Add,shownVals);
"polarz" <po****@hotmail.com> schrieb im Newsbeitrag
news:t3********************************@4ax.com...
here are the lines of code that I've tried. All crash the program

shownVals is a string array
data is my datatable

//problem code #1

loop here{
((Form1)NewsMyWay.Form1.ActiveForm).data.Rows.Add( shownVals);
}

//problem code #2

((Form1)NewsMyWay.Form1.ActiveForm).data.BeginLoad Data();

loop here{

((Form1)NewsMyWay.Form1.ActiveForm).data.LoadDataR ow(shownVals,false);

}

((Form1)NewsMyWay.Form1.ActiveForm).data.EndLoadDa ta();

//problem code #3

loop here{
((Form1)NewsMyWay.Form1.ActiveForm).data.BeginLoad Data();
((Form1)NewsMyWay.Form1.ActiveForm).data.LoadDataR ow(shownVals,false);
((Form1)NewsMyWay.Form1.ActiveForm).data.EndLoadDa ta();
}

I'm pulling data from the internet and trying to put it into my
dataGrid on the fly but I always recieve a

System.NullReferenceException

when the grid is populating or a few seconds after it has finished.
I've also tried to throw in

((Form1)NewsMyWay.Form1.ActiveForm).data.AcceptCha nges();

in various spots in my code but that does nothing. When I save the
downloaded data to a txt file I can import the data to the grid fine.
Unless there is too much data, that also causes a crash but is another
issue. I'm at a loss :/
Any suggestions are much appreciated. Thank you

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: greeningster | last post by:
I have written an application in Visual C++ for a customer but it seems to crash randomly. Could anyone give me any help on how I could track this down ? Also, there appears there might be...
4
by: polarz | last post by:
I've written a program that pulls data from the internet and puts it into a datagrid. When the number of rows reaches a certain point my program freezes. Is there a limit to the number of rows...
4
by: Cat | last post by:
If you have a datagrid with an underlying dataset and rows are added to the dataset during a program run, how do you get the datagrid to update itself to repflect the changes in the underlying...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
41
by: z | last post by:
I use Visual C 2005 to develop my programs. One in particular is crashing in very specific and hard to replicate situations, made worse by the fact it only crashes when run -outside- the dev - as...
0
by: Jameson | last post by:
Visual Studio 2008 (90 day trial, team suite edition) crashes with "Microsoft Visual Studio 2008 has encountered a problem and needs to close...." message when I try to create a new wpf application...
1
by: shikhargilhotra | last post by:
Hi All, I hav a datagrid on my asp.net platform..But itz not loading when i execute it...(or run the program...lets say a simplest one),,,,other controls are loading perfectly.....written below...
0
by: John [H2O] | last post by:
There's a lot of greek for me here ... should I post to numpy-discussions as well??? The backtrace is at the bottom.... Thanks! GNU gdb Fedora (6.8-21.fc9) Copyright (C) 2008 Free...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.