Click here to Skip to main content
16,004,574 members
Home / Discussions / C#
   

C#

 
QuestionCan some bright person solve this ? I am lost with this....so strange Pin
pierrecenti18-Jul-07 23:27
pierrecenti18-Jul-07 23:27 
AnswerRe: Can some bright person solve this ? I am lost with this....so strange Pin
gumi_r@msn.com19-Jul-07 1:37
gumi_r@msn.com19-Jul-07 1:37 
QuestionIndex error... Pin
Support12318-Jul-07 23:17
Support12318-Jul-07 23:17 
AnswerRe: Index error... Pin
Support12318-Jul-07 23:24
Support12318-Jul-07 23:24 
GeneralRe: Index error... Pin
Luc Pattyn18-Jul-07 23:30
sitebuilderLuc Pattyn18-Jul-07 23:30 
GeneralRe: Index error... Pin
Support12318-Jul-07 23:40
Support12318-Jul-07 23:40 
AnswerRe: Index error... Pin
Colin Angus Mackay18-Jul-07 23:30
Colin Angus Mackay18-Jul-07 23:30 
AnswerRe: Index error... Pin
Thaer Hamael19-Jul-07 0:04
Thaer Hamael19-Jul-07 0:04 
GeneralRe: Index error... Pin
Martin#19-Jul-07 0:11
Martin#19-Jul-07 0:11 
GeneralRe: Index error... Pin
Luc Pattyn19-Jul-07 0:37
sitebuilderLuc Pattyn19-Jul-07 0:37 
GeneralRe: Index error... Pin
Martin#19-Jul-07 0:55
Martin#19-Jul-07 0:55 
Questionhow to copy database ? Pin
help as an alias18-Jul-07 22:55
help as an alias18-Jul-07 22:55 
AnswerRe: how to copy database ? Pin
Colin Angus Mackay18-Jul-07 23:21
Colin Angus Mackay18-Jul-07 23:21 
GeneralRe: how to copy database ? Pin
help as an alias18-Jul-07 23:35
help as an alias18-Jul-07 23:35 
GeneralRe: how to copy database ? Pin
Colin Angus Mackay18-Jul-07 23:49
Colin Angus Mackay18-Jul-07 23:49 
QuestionThreading concept.. Pin
Ron.S18-Jul-07 22:40
Ron.S18-Jul-07 22:40 
AnswerRe: Threading concept.. Pin
Eduard Keilholz18-Jul-07 22:47
Eduard Keilholz18-Jul-07 22:47 
GeneralRe: Threading concept.. Pin
Ron.S18-Jul-07 22:58
Ron.S18-Jul-07 22:58 
AnswerRe: Threading concept.. Pin
Eduard Keilholz19-Jul-07 0:57
Eduard Keilholz19-Jul-07 0:57 
GeneralRe: Threading concept.. Pin
Ron.S19-Jul-07 2:41
Ron.S19-Jul-07 2:41 
GeneralRe: Threading concept.. Pin
Eduard Keilholz19-Jul-07 3:16
Eduard Keilholz19-Jul-07 3:16 
GeneralRe: Threading concept.. Pin
Ron.S19-Jul-07 19:39
Ron.S19-Jul-07 19:39 
GeneralRe: Threading concept.. Pin
Ron.S19-Jul-07 20:30
Ron.S19-Jul-07 20:30 
this is the code which i am using.

public void loaddata()
{
try
{
conn = new SqlConnection("Data Source=local; Initial Catalog=Northwind; User ID=sa; Password=; Persist Security Info =True;");
adpt = new SqlDataAdapter("Select * from Categories", conn);
ds = new DataSet();
adpt.Fill(ds);
listBox1.DataSource = ds.Tables[0];
//trd
listBox1.DisplayMember = "CategoryName";
Thread.Sleep(1000);
//trd.Start();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message.ToString());
}
}

on click of the button i am calling that thread.

private void btnStart_Click(object sender, EventArgs e)
{
try
{
// this is wokring

ThreadStart myThreadDelegate = new ThreadStart(loaddata);
trd = new Thread(myThreadDelegate);
trd.Start();
trd.IsBackground = true;
// till here
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}

}

this below code is to stop the thread.
private void btnStop_Click(object sender, EventArgs e)
{
//Thread trd = new Thread(new ThreadStart(this.loaddata));
//trd.Abort();
try
{
if ((trd.ThreadState == ThreadState.Running )|| (trd.ThreadState==ThreadState.Background))
{
trd.Abort();
}

}
catch (ThreadStateException Ex)
{
MessageBox.Show(Ex.ToString(), "Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1);
}
}

please help me..

Bharath.S Ron

QuestionCustom Tab Control Pin
T.EDY18-Jul-07 22:39
T.EDY18-Jul-07 22:39 
QuestionVisual studio error on load Pin
Russell Jones18-Jul-07 22:29
Russell Jones18-Jul-07 22:29 

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.