473,797 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)NewsMyW ay.Form1.Active Form).data.Rows .Add(shownVals) ;
}

//problem code #2

((Form1)NewsMyW ay.Form1.Active Form).data.Begi nLoadData();

loop here{

((Form1)NewsMyW ay.Form1.Active Form).data.Load DataRow(shownVa ls,false);

}

((Form1)NewsMyW ay.Form1.Active Form).data.EndL oadData();

//problem code #3

loop here{
((Form1)NewsMyW ay.Form1.Active Form).data.Begi nLoadData();
((Form1)NewsMyW ay.Form1.Active Form).data.Load DataRow(shownVa ls,false);
((Form1)NewsMyW ay.Form1.Active Form).data.EndL oadData();
}

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

System.NullRefe renceException

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

((Form1)NewsMyW ay.Form1.Active Form).data.Acce ptChanges();

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 1411
You use a "working" thread to load the data in the dataset?

Try to use the following piece of code:

Form1 f=(Form1)NewsMy Way.Form1.Activ eForm;
f.Invoke(f.data .Rows.Add,shown Vals);
"polarz" <po****@hotmail .com> schrieb im Newsbeitrag
news:t3******** *************** *********@4ax.c om...
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)NewsMyW ay.Form1.Active Form).data.Rows .Add(shownVals) ;
}

//problem code #2

((Form1)NewsMyW ay.Form1.Active Form).data.Begi nLoadData();

loop here{

((Form1)NewsMyW ay.Form1.Active Form).data.Load DataRow(shownVa ls,false);

}

((Form1)NewsMyW ay.Form1.Active Form).data.EndL oadData();

//problem code #3

loop here{
((Form1)NewsMyW ay.Form1.Active Form).data.Begi nLoadData();
((Form1)NewsMyW ay.Form1.Active Form).data.Load DataRow(shownVa ls,false);
((Form1)NewsMyW ay.Form1.Active Form).data.EndL oadData();
}

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

System.NullRefe renceException

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

((Form1)NewsMyW ay.Form1.Active Form).data.Acce ptChanges();

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
3856
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 memory leaks too. How can i track these down ?
4
1897
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 you can add? If so, is there a way to get around this? Any suggestions are much appreciated. Thanks.
4
5039
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 dataset? I've tried Update() and Refresh() but these don't seem to work. Only thing that works is rebinding the datset to the datagrid control, but this doesn't seem to be quite right. Cat
5
12240
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. The ID is a member of the keys array. I then create a DataView dv over the table, and sort it by Display and ID column (in case of duplicate Display). I then set my DataGrid.DataSource = dv; I then load the datatable with my rows, and this is...
5
2795
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 to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
41
2480
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 an exe, not from the Debug option. If I try to launch the debug on the crashing program, it'll close before the debugger opens. Any suggestions as to how I should proceed? Thanks in advance.
0
1748
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 project. Also, loading an existing wpf project (the "hittest3d" demo) works, but the program terminates when the system tries to display the test project main window (ie. step into the program, debugging just stops at new window1()). Possibly...
1
942
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 is d code.... A quick help will b appreciated... thx Shikhar PROGRAM ##### using System.Data.SqlClient;
0
1824
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 Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.