|
You can get this error message if your Distributed Transaction Coordinator service is not running. Use Administrative Tools to check the Status of the service has Started and that the Startup Type is Automatic.
Also, the default timeout/timespan is 1 minute and the default machine config caps it to 10 minutes.
modified on Wednesday, August 26, 2009 11:14 PM
|
|
|
|
|
Hi
Im placing some controls dynamically on tool strip control and i'm handling that controls click event as well tool strips click event. But when ever i click the control it triggers both the event.
I want to cancel tool strips event when i click the control.. how can i do this?
|
|
|
|
|
Do you need the toolstrip's Click event to be handled at all (I've never found a need for it personally as all I'm ever interested in is the items, not the strip)?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Well, I'm handling tool strip click event also with different context.
|
|
|
|
|
|
What is it that you are using the ToolStrip's click event for?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
Do you have any idea on how to attache image/docs/pdf saved from SQL DB then send it to email?
All the attachements of diff. docs are all saved in our SQL DB, they want me to send the attched files as per record at attachment to email.
PLSzzz.
Dabsukol
|
|
|
|
|
Have a look at this[^]
The example is in VB.Net but I hope you can easily convert it to C#.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
form name is "Test".
i want to close this form using short cut Alt+F4
cany anyone help me
|
|
|
|
|
Normally this should work by default...
|
|
|
|
|
Just press Alt+F4 in your keyboard. The form will be closed automatically.
You don't need to write some codes for that.
|
|
|
|
|
It should just work as others have said. If for some reason it doesn't, you can code it yourself. This is a little function I use occaisionally to do the opposite - stop Alt+F4 closing the form. Adapt it to suit.
private const int WM_SYSKEYDOWN = 0x0104;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
return ((msg.Msg == WM_SYSKEYDOWN) && (keyData == (Keys.Alt | Keys.F4)));
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
try
{
int i = 1;
int j = 2;
return i;
}
finally
{
i += 3;
}
The code in the finally statement will be executed ? when? before return or after return ?
|
|
|
|
|
What happened when you tried?
|
|
|
|
|
Well, that's a dumb question. If there's no other code, then before or after the return are basically the same thing, excepting that when the code returns, i will no longer exist. In fact, I don't think this will compile, because the scope of i is the try block, I think you need to define it outside the try for the catch to see it.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Well that is a dumb answer because it's totally unhelpful!
You're right that it won't compile, but surely you can see that the question works by simply declaring i at the method level instead. And there is in fact a subtle effect of the try-finally.
int foo()
{
int i = 1;
try { return i; }
finally { i = 5; }
}
This code compiles, but what does foo() return? I think quite a lot of people would expect it to return 5, since the finally block is executed before the method returns. But the return value is *evaluated* before the finally block runs and the method returns 1.
Now what would happen if we boxed the int in a class of our own?
class BoxedInt { public int Value; }
BoxedInt bar()
{
BoxedInt i = new BoxedInt() { Value = 1 };
try { return i; }
finally { i.Value = 5; }
}
While foo() returns 1, bar() returns a BoxedInt whose Value is 5. That's because BoxedInt is a class and thus a reference type, so it does not matter if the return value is evaluated before or after the finally block executes. Change BoxedInt to a struct, and bar will return a BoxedInt with Value equal to 1 as well.
I'd say there's some subtlety here, so calling that a stupid question seems to me rather a stretch.
|
|
|
|
|
So... you did try it, but asked the question anyway?
|
|
|
|
|
Now that got me nicely confused.
You replied to my message so presumably "you" means me. But what "it" and "the question" refers to is less clear. I tried many things including compiling and running the various code snippets I've put up on this thread. I may have asked questions too, but I am not the OP so if you were referring to the original message that might explain the confusion.
If you did mean I tried something (and consequently found out what it does) and still asked what it does, let me know what it was and I will attempt to communicate whatever it was I was wondering about more clearly.
|
|
|
|
|
Whoops, I meant to reply to the OP.
|
|
|
|
|
I think it was an interesting question... thou I don't see why you need to ask when you can just try yourself. Thou as Christian said, you variable in the finally block is not in scope.
The answer would appear that the finally code is executed after the return thou I would say that the function is not complete until after the finally block. That means whenever return is called then that is the value that will be return regardless of what is done in the finally block.
I wonder what would happen if you put a return in the finally block too....
...oh, you cant return from a finally block.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The answer is in fact more subtle: The finally block executes before the method returns, but the return value is *evaluated* before the finally block runs. Because his code works with a value type (int) the increment he did in the finally is not reflected in the return value of the method - it's as if the compiler transformed return i; to int ret = i; i += 3; return ret; , executing the finally block after evaluating the return expression, but before returning. If it had been an object (reference type) and the finally modified the state of that object, the caller would "see" the changes made by the finally block. See my replies above if you want more details.
|
|
|
|
|
That's the same thing I said just using different words, so maybe before correcting me you should have spent time understanding what I said and not just repeating me and thinking that you have given a different answer.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I'll try to remember you're an ungrateful little brat. Actually you didn't say half of what I did, although you did say something vaguely similar. (Don't reply just to repeat a claim - readers can just look at the thread and decide for themselves.)
|
|
|
|
|
You know, going round insulting the regulars isn't a good way to endear yourself to a community.
|
|
|
|
|
And you think I deserved the snotty reply he gave me? I think I contributed a very clear explanation of what exactly happens and provided more information than he had done (his explanation was onto something, but didn't point out how reference versus value types would affect the outcome - so I had something to add).
It's up to you whether you rate contributions according to how regularly the author posts messages. I'd rather rate them for quality and value. And I reserve the right to return rudeness to anyone, regular or not.
|
|
|
|