|
Hi John,
does this[^] help? The first hit seems to give a kind of workaround...
|
|
|
|
|
I presume this is a Windows.Forms application?
|
|
|
|
|
Yes, it's windows forms app...
BTW, I'm using VS2005, and at this time, I can't switch to VS2008 (just heading off a suggestion to try VS2008).
BTW, even if I reduce the worker contents to its simplest form, I still get the problem.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Some of the properties in a class I was trying to use were not simple set/get properties. As soon as I change them, everything was okay.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
At least you've got it answered
|
|
|
|
|
I'm making some custom controls basically, just to control the look of stuff.
I have a "LookAndFeel" class which contains properties to keep the Font, BackColor, ForeColor and stuff consistent through out the app.
The Font and ForeColor are fine... the BackColor is doing something I don't understand.
I have this in a Button control and I set the BackColor in my class to MediumPurple... when I drop the button on a form, it is displaying the normal default gray. The property windows says it should be MediumPurple and in the designer it is clearly set to MediumPurple. Everything else is working except BackColor
What am I missing here?
Thanks.
|
|
|
|
|
It's really weird too... for like a split second after dropping the button, it is MediumPurple... then it changes to Gray.
I don't get it.
|
|
|
|
|
I'm not seeing that problem (in VS 2008).
Do other controls appear as expected?
|
|
|
|
|
Yes they do... I'm working in vs05. this is just weird.
Everything else I assign a value to works, except BackColor.
|
|
|
|
|
I just tried it in VS2005 with no trouble, so there must be something in your code.
At which point do you set the BackColor?
|
|
|
|
|
Hi...
The "UseVisualStyleBackColor" property we set to "True", set to "False" this works.
Thank you for the reply.
|
|
|
|
|
hi,
I used below code for get mht file from given URL.
But sometimes it dosn't work and wait.
CDO.Message msg = new CDO.MessageClass();
ADODB.Stream stm = null;
byte[] data;
msg.MimeFormatted = true;
msg.CreateMHTMLBody(givenUrl, CDO.CdoMHTMLFlags.cdoSuppressAll, "", "");
string path = destinationPath + "\\" + fileName;
stm = msg.GetStream();
stm.SaveToFile(path, ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
msg = null;
stm.Close();
when I debugged the code I saw this error in:
msg
--[CDO.MessageClass]
---- all items has error
"Cannot evaluate expression because a native frame is on top of the call stack"
it was stuck at this line :
msg.CreateMHTMLBody(givenUrl, CDO.CdoMHTMLFlags.cdoSuppressAll, "", "");
are there any way to get if isTimeout or not?
thanx...
I want to fly but I don't have wings
modified on Saturday, July 26, 2008 11:18 AM
|
|
|
|
|
If you stop the code in the middle of unmanaged code, the debugger can't reach the items on the stack that is created by the managed objects because it doesn't know the size of the unmanaged stack frame. You have to step through the unmanaged code back into the managed code before the debugger can show you the contents of the stack.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes, you are right.
I got it.
I need timeout option, but there is no timeout property or parameter etc...
I tested again the code if it will stuck or won't.
It is still same but after 4-5 minutes it was aborted and it worked.
4-5 minutes is too long for me.
I will work with thousands url, I can't wait 5 minutes for each url.
How can it continue after 15 seconds?
Is it possible?
I want to fly but I don't have wings
|
|
|
|
|
guys,
i need help how to approach/any idea to generate a list of names in a random. what i mean is i have an excel file which has list of employee names then when i click a button. it will give a random group. for example. 50 names in 1 group. it will give a result in a text file.
thanks in advance. i really appreciate your help.
C# Coudou
Microsoft End User
2000-2008
******************************
The best things in life are free
******************************
|
|
|
|
|
What I have done for that sort of thing is to have another table with two columns; one for the IDs of records in the main table and populate the other column with random numbers.
When it's time to select records; clear out the table, populate the table, then query the table, sorting by the random number column, and use the first 50 (or whatever) IDs.
You could simply add a random number column to the main table, but my process was trickier than that.
|
|
|
|
|
hope this helps!
First, read all the names from the excel file, probably into an array.
then, use some randomizing technique, and maybe a loop, to select your group.
and lastly, while selecting, write the names to a text file.
He who goes for revenge must first dig two graves.
|
|
|
|
|
Creamboy wrote: then, use some randomizing technique
Riiight... isn't that the part he's asking about? 
|
|
|
|
|
Put the available names in an array, then this method will pick the specified number of strings from it:
private string[] PickFrom(string[] values, int count) {
Random r = new Random();
string[] result = new string[count];
for (int i = 0, index = 0; index < count; i++) {
if (r.Next(values.Length - i) < count - index) {
result[index++] = values[i];
}
}
return result;
}
Usage:
string[] group = PickFrom(listOfNames, 50);
Note: The names in the returned array will be in the same order relative to each other as in the original array. If the original array is sorted, the resulting array will also be.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Guffa,
I like that approach very much.
I was puzzled though by the details of the conditional test.
Shouldn't all candidate values get the same probability?
IMO the test should read if ( r.Next(values.Length) < count )
so each value[i] has probability count/value.Length
[ADDED] I see now. With fair probabilities, the algo may fail altogether,
when r decides to return lots of large numbers. So you are cheating a bit
to make it work all the time, at the expense of the first elements in the array,
since your probabilities are increasing at first.
Very clever. A little explanation was in order though.
[/ADDED]
|
|
|
|
|
Luc Pattyn wrote: Shouldn't all candidate values get the same probability?
IMO the test should read if ( r.Next(values.Length) < count )
so each value[i] has probability count/value.Length
All the candidates get the same probability. The probability for each candidate depends on how many of the previous candidates were picked. For example, if you reach the last candidate (with still one to pick), the probability for that one will be 100%.
Luc Pattyn wrote: So you are cheating a bit
to make it work all the time, at the expense of the first elements in the array,
since your probabilities are increasing at first.
Not at all. There is no cheating at all, the randomness is completely accurate.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Sorry, my mistake. I did a little example earlier (5 out of 10), but went wrong early on, so it looked
as if probabilities were increasing with i. But they are not, everything was fine when I tried it once
more. This is a fantastic little algorithm, and I hadn't seen it before. Thanks.
|
|
|
|
|
That's one to remember. And I suppose an Excel macro could be written to implement it.
|
|
|
|
|
Hello Friends,
I want to know how can we share desktop. I know this is very hard to do all the things,
but here i am asking for any demo example from which i can learn more.
Thanks in Advance.
Best Regards,
Chetan Patel
|
|
|
|
|