|
Your biggest problem with this code is that the _Event.WaitOne(); is causing the GUI thread to wait until signalled.
This is a great example of a deadlock situation.
Phil
|
|
|
|
|
Not exactly. _Event.WaitOne() is actually called on another thread besides GUI thread so it's not telling the GUI thread to wait but the other thread to wait. Also, the problem occurs before it gets to _Event.WaitOne(). It happens when the Timer starts. Inside the method called by the Timer it keeps invoking itself.
if (this.InvokeRequired)
{
EventHandler Handler = new EventHandler(startProgressBar);
this.BeginInvoke(Handler, sender, e);
}
else
{
...
progressBar1.PerformStep();
...
}
|
|
|
|
|
You know best, we can not possibly improve what you do.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm trying to get help on the forum here not looking for sarcastic comments. You're very rude...
|
|
|
|
|
You are new on this forum. Maybe you dont understand how it works.
If you choose to ignore both valid remarks and questions asked, you will be on your own.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
How exactly am I ignoring valid remarks? I got two reponses and I replied both of them the best I could. For your response, you commented about "Do this on Windows Form" which I explained what it really meant etc. For the other response, the person pointed out a possible Deadlock which I replied that it's not the problem because in the code it doesn't even get to that part before it freezes up. All I'm doing is trying to point out the problem I'm having and clearifying it. Both reponses I received did not solve the problem so am I suppose to say thanks and not pursue it any more further simply because I'm new and "don't understand how it works?" Thanks but no thanks. I'll go somewhere else. Thanks for your help. Have a good day.
|
|
|
|
|
For us on this forum to be able to drill down to the actual problem being experienced with this code you will have to post a more explicit example. Otherwise, we have to make assumptions and our assumptions will be incorrect.
Phil
|
|
|
|
|
Hello All
I m facing one problem in C# Windows Application
That one is RPC Server Unavailable while open excel sheet
I m using excel object com object
i just want to import data into SQL Database
first i open the excel sheet and then read the excel finally store data into sql
but Excel object throw one error RPC Server unavailable
The error occur in the following code
WorkBook = ExpApp.Workbooks.Open(System.Windows.Forms.Application.StartupPath + "\\Clone.xls", 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "\t", true, false, 0, true);
anybody plz help me
it s very urgent
Thanks in Advance
Sak
|
|
|
|
|
|
Thanks for ur command
but i m using Excel COM Object for reading excel data
so i need solution for rpc server unavailable using Excel dll
Thanks
Sak
|
|
|
|
|
How do I declare a queue of string arrays?
Queue<string[]> qVar = new Queue<???>;
|
|
|
|
|
you almost did that just here is the complete one
Queue<string[]> qString = new Queue<string[]>();
good luck
|
|
|
|
|
Ahh, I was trying Queue<string[]> but forgot the () after the fact.
Thanks!
|
|
|
|
|
Hi,
DataGridView gives only primary sort (by one column).
How can i define a secondary sort in a bound data GridView?
(I saw a solution for unbound data only)
Thanks
dana Tov
|
|
|
|
|
I have the following problem
-I created a form with an tab control
-I the tab control contains (minimum) 2 tab pages
-In the second (non selected) tab page i have a control
-And there is another formular (irrelevant content)
<br />
#region PREPERATION<br />
Form f = new Form();<br />
TabControl t = new TabControl();<br />
<br />
TabPage tp1 = new TabPage("page1");<br />
TabPage tp2 = new TabPage("page2");<br />
<br />
Button b = new Button();<br />
b.Size = new Size(100, 20);<br />
<br />
tp2.Controls.Add(b);<br />
<br />
t.TabPages.Add(tp1);<br />
t.TabPages.Add(tp2);<br />
<br />
this.Controls.Add(t);<br />
t.BringToFront();<br />
#endregion PREPERATION<br />
When i first open the child-form with Show() and then select the tab page with the control the parent-form is focused again.
f.Show();<br />
t.SelectedIndex = 1;
How can i force the child-form to keep its focus, while the parent change the tab page?
I don't want to use ShowDialog() or Show(this).
Is this a bug or a feature of the tab control (tab page)?
(Is the only way to fix it, changing the order of the source code?)
|
|
|
|
|
Try tp2.Select(); You don't want to select the tab control, but the actual tab with the control on it.
Hogan
|
|
|
|
|
It does not work.
It don't show the tab page (tp2).
|
|
|
|
|
Does anyone have another idea?
|
|
|
|
|
Hi
Can anyone tell me how to generate a date in random in the interval of two dates (Max date and the Min date)...
Please anyone suggest the answer soon as my due date is nearing
Thx
Anjum
|
|
|
|
|
search on google for "c# random" it'll tell you about the random class ... the random class takes a min int and a max int ... the rest you just need to code.
|
|
|
|
|
I think you can do that with Random Class and DateTime Struct
you can get number of available days in each month with DateTime.DaysInMonth method for correct random date generating and then simply put your generated random numbers from random class in the Constructor of DateTime struct and you will have it.
|
|
|
|
|
1) Calculate the number of days between MIN & MAX.
2) Get random number within that range.
3) Add the random number to MIN.
TimeSpan ts = DateTime.Parse("12/31/2006") - DateTime.Parse("1/1/2006");
Random r = new Random();
int randomDays = r.Next(ts.Days + 1);
DateTime randomDate = DateTime.Parse("1/1/2006").AddDays(randomDays);
MessageBox.Show(randomDate.ToShortDateString());
|
|
|
|
|
It means that when user press F1, help of the application will load in a special form. How can I do this?
Pls help!
|
|
|
|
|
Hi
You just use c# namespace
using System.Runtime.InteropServices;
Process.Start("Test.Chm")
so you can call anykind file using the above code and also connect to internet use these code
Sak
|
|
|
|
|
Thanks Sak,
What is the Process is?
|
|
|
|