Click here to Skip to main content
16,005,149 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows Service problem 2 Pin
Matt Philmon12-Oct-04 18:23
Matt Philmon12-Oct-04 18:23 
GeneralRe: Windows Service problem 2 Pin
ting66812-Oct-04 18:28
ting66812-Oct-04 18:28 
GeneralRe: Windows Service problem 2 Pin
Matt Philmon12-Oct-04 18:49
Matt Philmon12-Oct-04 18:49 
GeneralRe: Windows Service problem 2 Pin
ting66813-Oct-04 0:07
ting66813-Oct-04 0:07 
Generalcontext menu Pin
ppp00112-Oct-04 16:16
ppp00112-Oct-04 16:16 
Generalhttps server Pin
ppp00112-Oct-04 16:00
ppp00112-Oct-04 16:00 
GeneralRe: https server Pin
Matt Philmon12-Oct-04 18:12
Matt Philmon12-Oct-04 18:12 
GeneralPopulating DataGrid with thread Pin
GA-BOYZ12-Oct-04 14:52
GA-BOYZ12-Oct-04 14:52 
Hi,

I am trying to populate my datagrid with thread, since the data is quite large, so the user can still do something else while the data being populated in the background.
The data are retreived from SQL database.

So the form will begin populating datagrid when I click on Reload button.
This is what I tried :

<br />
private void btn_reload_Click(object sender, System.EventArgs e)<br />
{<br />
	// Create and run thread to load data<br />
	fthread_parts_daftar = new Thread(new ThreadStart(RefreshGridParts));<br />
	fthread_parts_daftar.Priority = ThreadPriority.Normal;<br />
	fthread_parts_daftar.IsBackground = true;<br />
	fthread_parts_daftar.Start();	<br />
}<br />
<br />
private void RefreshGridParts()<br />
{<br />
	ds_parts.Tables["tabel_parts_daftar"].Clear();<br />
	partsDA.Fill(ds_parts, "tabel_parts_daftar");<br />
	<br />
	grid_partno.Refresh();<br />
<br />
	// Stop thread<br />
	fthread_parts_daftar.Abort();<br />
}<br />


This code gave me the following error :
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.

When I removed the thread and just use fill command on the DataAdapter, it worked fine.
So I looked at the threading, and cannot find any mistakes on it.

I am a newbie in C#, and don't have many experience.
Please kindly help me to solve this problem.

Thank you very much in advance.
GeneralRe: Populating DataGrid with thread Pin
Vasudevan Deepak Kumar12-Oct-04 23:59
Vasudevan Deepak Kumar12-Oct-04 23:59 
GeneralRe: Populating DataGrid with thread Pin
GA-BOYZ13-Oct-04 5:08
GA-BOYZ13-Oct-04 5:08 
QuestionThrow Exception - how expensive is it really? Pin
elguaro12-Oct-04 14:51
elguaro12-Oct-04 14:51 
AnswerRe: Throw Exception - how expensive is it really? Pin
Christian Graus12-Oct-04 15:36
protectorChristian Graus12-Oct-04 15:36 
GeneralRe: Throw Exception - how expensive is it really? Pin
elguaro12-Oct-04 17:11
elguaro12-Oct-04 17:11 
GeneralRe: Throw Exception - how expensive is it really? Pin
Stefan Troschuetz12-Oct-04 20:48
Stefan Troschuetz12-Oct-04 20:48 
GeneralRe: Throw Exception - how expensive is it really? Pin
Christian Graus13-Oct-04 9:01
protectorChristian Graus13-Oct-04 9:01 
GeneralRe: Throw Exception - how expensive is it really? Pin
elguaro13-Oct-04 13:27
elguaro13-Oct-04 13:27 
GeneralRe: Throw Exception - how expensive is it really? Pin
Christian Graus14-Oct-04 9:14
protectorChristian Graus14-Oct-04 9:14 
GeneralRe: Throw Exception - how expensive is it really? Pin
elguaro14-Oct-04 16:55
elguaro14-Oct-04 16:55 
GeneralRe: Throw Exception - how expensive is it really? Pin
Christian Graus17-Oct-04 9:51
protectorChristian Graus17-Oct-04 9:51 
GeneralRe: Throw Exception - how expensive is it really? Pin
elguaro17-Oct-04 14:00
elguaro17-Oct-04 14:00 
GeneralRe: Throw Exception - how expensive is it really? Pin
Nemanja Trifunovic17-Oct-04 14:54
Nemanja Trifunovic17-Oct-04 14:54 
GeneralMedia Player SDK Pin
Christian Graus12-Oct-04 14:47
protectorChristian Graus12-Oct-04 14:47 
GeneralNot an answer, but an alternative. Pin
Matt Philmon12-Oct-04 18:02
Matt Philmon12-Oct-04 18:02 
GeneralRe: Media Player SDK Pin
Dave Kreskowiak12-Oct-04 18:11
mveDave Kreskowiak12-Oct-04 18:11 
GeneralRe: Media Player SDK Pin
Christian Graus13-Oct-04 9:05
protectorChristian Graus13-Oct-04 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.