Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
GeneralRe: Add attributes to XML doc Pin
VK-Cadec19-Jul-06 7:26
VK-Cadec19-Jul-06 7:26 
GeneralRe: Add attributes to XML doc Pin
Rob Graham19-Jul-06 10:45
Rob Graham19-Jul-06 10:45 
QuestionApplication deep logging/traceing Pin
nemopeti19-Jul-06 6:24
nemopeti19-Jul-06 6:24 
AnswerRe: Application deep logging/traceing Pin
Judah Gabriel Himango19-Jul-06 7:16
sponsorJudah Gabriel Himango19-Jul-06 7:16 
GeneralRe: Application deep logging/traceing [modified] Pin
nemopeti19-Jul-06 10:57
nemopeti19-Jul-06 10:57 
GeneralRe: Application deep logging/traceing Pin
Alexander Wiseman19-Jul-06 11:36
Alexander Wiseman19-Jul-06 11:36 
GeneralRe: Application deep logging/traceing [modified] Pin
nemopeti19-Jul-06 11:54
nemopeti19-Jul-06 11:54 
QuestionStatus bar's progress bar Pin
Elvis_Pretzelator19-Jul-06 5:27
Elvis_Pretzelator19-Jul-06 5:27 
My progress bar in the status bar doesn't want to run.

The application I created is a SQL tool for an oracle db I work on. Basically, I just type my SQL code in a RichTextbox and then the data comes back in my datagrid. That works fine.

I thought it would be cool if I could add a progress bar and set it to marquee while I was waiting for my data to come back.

I'm pretty sure I need to multi-thread this beasty but when I do I get the following message: "Cross-thread operation not valid: Control 'rtbSQL' accessed from a thread other than the thread it was created on."

Here's what I passed to the new thread (which is created when I click the run button):

btnRunSQLClick(bla bla...)
{
Thread t1 = new Thread(new ThreadStart(GetData));
t1.Start();
}

the GetData() code:

public void GetData()
{
try
{
da=new OdbcDataAdapter(this.rtbSQL.Text, this.cnn);
cb=new OdbcCommandBuilder(da);
dt=new DataTable();
da.Fill(dt);
}
catch(OdbcException ex)
{
MessageBox.Show(ex.Message);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

this.dataGrid1.DataSource = dt;

}



Any ideas? I'm definitely a novice at threading!!
AnswerRe: Status bar's progress bar Pin
Not Active19-Jul-06 5:37
mentorNot Active19-Jul-06 5:37 
AnswerRe: Status bar's progress bar Pin
Stefan Troschuetz19-Jul-06 6:33
Stefan Troschuetz19-Jul-06 6:33 
QuestionHuge file [modified] Pin
abalfazl19-Jul-06 5:24
abalfazl19-Jul-06 5:24 
AnswerRe: Huge file Pin
Not Active19-Jul-06 5:32
mentorNot Active19-Jul-06 5:32 
AnswerRe: Huge file Pin
Super Lloyd19-Jul-06 5:33
Super Lloyd19-Jul-06 5:33 
GeneralRe: Huge file Pin
abalfazl19-Jul-06 5:50
abalfazl19-Jul-06 5:50 
GeneralThe solution Pin
Ennis Ray Lynch, Jr.19-Jul-06 7:00
Ennis Ray Lynch, Jr.19-Jul-06 7:00 
GeneralRe: The solution Pin
Dan Neely19-Jul-06 7:27
Dan Neely19-Jul-06 7:27 
Generalwell duh Pin
Ennis Ray Lynch, Jr.19-Jul-06 8:36
Ennis Ray Lynch, Jr.19-Jul-06 8:36 
GeneralRe: Huge file Pin
Super Lloyd19-Jul-06 13:36
Super Lloyd19-Jul-06 13:36 
QuestionA question about Asyn-communicating by using UdpClient of .NET. Pin
weiyuw19-Jul-06 5:19
weiyuw19-Jul-06 5:19 
QuestionDateTime picker control Pin
Balaj_C19-Jul-06 5:18
Balaj_C19-Jul-06 5:18 
AnswerRe: DateTime picker control Pin
Not Active19-Jul-06 5:49
mentorNot Active19-Jul-06 5:49 
GeneralRe: DateTime picker control Pin
Balaj_C19-Jul-06 6:14
Balaj_C19-Jul-06 6:14 
QuestionProblems with Interop and Excel versions Pin
Gavin_RTE19-Jul-06 5:11
Gavin_RTE19-Jul-06 5:11 
QuestionTimers not working Pin
donkaiser19-Jul-06 4:42
donkaiser19-Jul-06 4:42 
AnswerRe: Timers not working Pin
stancrm19-Jul-06 4:55
stancrm19-Jul-06 4:55 

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.