|
Pete O'Hanlon wrote: I put on my extra cynical underpants this morning
Wow, great minds think alike.
I put my ones on as well, except mine are thermal cynical underpants.
|
|
|
|
|
There's no way to help you bypassing captcha's protections. Sorry.
|
|
|
|
|
Yep... use a keyboard
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The whole point behind a CAPTCHA is to keep automation code from using the system. Sorry, but we're not going to help you get past something that someone OBVIOUSLY doesn't want to getting past.
|
|
|
|
|
Dear Friends,
I want to wrap the text that i am entering into the notepad file being generated with the help of C#.Net2008, but not able to find any method, property for the same. Like if the entered text reaches the end of the screen visible to user (while maximize of a notepad) then the cursor moves to the next line.
Could any one help me in this regard?
Thanks
Varun Sareen
|
|
|
|
|
You need to write a CR and LF to the text at the point you want it to wrap.
If you want it to wrap at a point dependent on the width of the notepad window, then turn on WordWrap in notepad, and don't put any CRLF in your written output.
|
|
|
|
|
|
Hi
I want to load a Form in a Control Like PanelControl in c# Windows Form
in this way:
ContainerControl.Controls.Add(myForm)
can somebody help me?!!
I am using DevExpress10 and 4.0 framework
regards
Sepantanima
|
|
|
|
|
Change the Form to a UserControl and then you can host it.
|
|
|
|
|
thank for your help
but This Form is for a none objective mind Programmer that has been written in three years and is so heavy code to trace so i want a quickest way to use it in my Project Main Form
regards
|
|
|
|
|
you can add a Form to any kind of Container, such as a Panel; you do have to clear its TopLevel property before you can add it though.
|
|
|
|
|
Hi Tanks
I do so but Form2 did not apeared in Form1.Panel1 without eny errors.
I do like this:
Form2 frm = new Form2();
frm.TopLevel = false;
frm.Dock = DockStyle.Fill;
panel1.Controls.Add(frm);
and i do in this way with same result:
panel1.Controls.Add(new Form2() {TopLevel = false,Dock=DockStyle.Fill });
|
|
|
|
|
you still have to call Show() on the form. This works for me:
private void button2_Click(object sender, EventArgs e) {
AboutBox1 a=new AboutBox1();
a.Show();
a.TopLevel=false;
a.Dock=DockStyle.Fill;
panel1.Controls.Add(a);
}
|
|
|
|
|
Tanks all i got my Solution
It was that I just missed to show frm
frm.Show();
|
|
|
|
|
I have sql server code within try - catch and i have the following in the finally:
if reader is open the close()
if connection is open the close()
my question, do I still have to include the reader.close() and connection.close() at the end of try and catch or finally will always take care f it?
|
|
|
|
|
It will take care of it. Finally is executed always.
Never forget to Dispose any of the ODP.NET objects
|
|
|
|
|
d@nish wrote: Finally is executed always.
Errm. No it's not. In the case of a StackOverflowException and an OutOfMemoryException , the program terminates abnormally and the exception cannot be caught, so the finally does not get executed.
|
|
|
|
|
Also not if you call System.Environment.FailFast (which you shouldn't).
|
|
|
|
|
As d@nish has said the finally block takes care of them.
However, as both of the classes implement IDisposable , you should consider using the using construct which would mean that you will not need the Finally block.
using (SqlConnection myConnection = new SqlConnection(...............))
{
...............................
...............................
...............................
myConnection.whatever = ?????
try
{
...............................
...............................
...............................
using (SqlDataReader myReader = new SqlDataReader(.......))
{
while (myReader.Read())
{
...............................
...............................
}
}
}
catch (....)
{
...............................
}
}
The using[^] construct guarantees disposal.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Right. That fully stops finally...
|
|
|
|
|
Or, it stops finally fully.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
So what is the real benefit of a using statement vs doing something like this:
SqlConnection conn = new SqlConnection("blah");
SqlCommand cmd = new SqlCommand("blah", conn);
try
{
SqlDataReader r = cmd.ExecuteReader();
while (r.Read())
{
}
r.Close();
}
catch (Exception ex)
{
}
finally
{
cmd.Dispose();
conn.Close();
conn.Dispose();
}
It was my understanding that the using statement after it has been compiled just automatically generated a try, catch, finally statement. The only thing is you can't really control much of what happens when the exception is catch (like write to a custom log file, or system events)
|
|
|
|
|
Please understand that I am by no means an expert in this regard (well, almost any regard, actually ) but my understanding is that it does the equivalent of a nested try-finally block, whether the IL is identical I'm not sure, so that the resource are released earlier rather than waiting for the main t-c-f block to end. I think that anything that avoids nested t-c-f is preferable as they are difficult to read and just plain ugly.
From the MSDN page
The using statement allows the programmer to specify when objects that use resources should release them.
Also from MSDN
A using statement can be exited either when the end of the using statement is reached or if an exception is thrown and control leaves the statement block before the end of the statement.
I have always taken this to mean that disposal will take place even if one of the Exceptions mentioned by PO'H above occurs. It is always possible that I am wrong on that count though.
[Edit]
I have just found this[^] article which, would seem to confirm your assertion that using generates a try-finally in the IL code. So the only real benefit would be tighter control over when resources are disposed and slightly neater, IMO, code.
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
modified on Sunday, November 14, 2010 8:47 PM
|
|
|
|
|
Jacob D Dixon wrote: It was my understanding that the using statement after it has been compiled just automatically generated a try, catch, finally statement. The only thing is you can't really control much of what happens when the exception is catch (like write to a custom log file, or system events)
You're correct that you can't control what happens in the catch - which I suppose is why a catch is *not* generated. A try/finally is generated. The overloaded "using" keyword in this context is a shorthand for not having to code a try/finally block. But if you have an exception to catch, you still have to catch it.
|
|
|
|
|
Ahh kk. Thanks! I guess if you were not worried about catching any exceptions then this would be pretty good to use. Personally I like to do something with any exception that is throw.. even if it is just logging it for debugging purposes.
|
|
|
|