|
Frnds,
IN MDI application whn one form is open and than want to open another form. How to close/hide the previous form?
|
|
|
|
|
To Close a form...
this.Close();
To Hide a form... Can you guess what it is yet?...
this.Hide();
If this is not enough of an answer then you need to try explaining your situation better
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
OK, this i Know. Lemme explain :
when i run my application my default form opens which is going to contain the child form. Now on that form i have my menustrip which contains multiple forms links.
When i select any of them than that form opens on the default form(without closing the default form) and when i again open the next form than the previous is still in open state. So at this point all three forms are open one over other.
This where i need to close the previous form.
|
|
|
|
|
OK so you are basically saying that you only want one child form open at a time?
Well when you open a child form, you need to keep a reference to it somewhere, like in you main form you have a global variable like...
Form openForm;
... then when you open a new child form (by clicking one of the links) then you test to see if one is open already, close it if so, then open the new child form like so...
void ButtonClick(object sender, EventArgs e)
{
if(!(openForm == null || openForm.IsDisposed))
{
openForm.Close();
}
openForm = newChildForm();
openForm.Show();
}
Life goes very fast. Tomorrow, today is already yesterday.
modified on Thursday, May 21, 2009 5:54 AM
|
|
|
|
|
|
when we give the print from internet explorer,
any of the Printing events are not fired?
Why? This was the code I'm trying with
System.Drawing.Printing.PrintDocument Pd = webBrowser.Document as System.Drawing.Printing.PrintDocument;
Pd.Print();
Pd.BeginPrint += new System.Drawing.Printing.PrintEventHandler(Pd_BeginPrint);
Pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Pd_PrintPage);
Pd.EndPrint += new System.Drawing.Printing.PrintEventHandler(Pd_EndPrint);
Here webBrowser gives the Internet Explorer reference?
How can I get these events get fired?
|
|
|
|
|
Printing is always done at client side and not at the server.
Have a look here[^].
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
those events have been attached to a specific instance of a PrintDocument and will only fire when that PrintDocument calls for those functions.
your code is calling the Print(); function of the PrintDocument but your events are not attached until afterwards.... Thou I suspect you wont be able to get it working if you did call Print(); after you attached the events, but we shall see about that
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
when I consider the browser document as PrintDocument,
when we give the page for Print through File->Print-> select the required printer ->OK
but also, none of the above events gets fired?
what may be the reason?
System.Drawing.Printing.PrintDocument Pd = new System.Drawing.Printing.PrintDocument();
Pd.BeginPrint +=new System.Drawing.Printing.PrintEventHandler(Pd_BeginPrint);
Pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Pd_PrintPage);
Pd.EndPrint += new System.Drawing.Printing.PrintEventHandler(Pd_EndPrint);
This also doesn't make any event get fired?
|
|
|
|
|
|
I just told you your events have been assigned to a specific instance of a PrintDocument i.e. Pd
These events will only fire when you call Pd.Print(); and it must be called after the events are assigned...
System.Drawing.Printing.PrintDocument Pd = new System.Drawing.Printing.PrintDocument();
Pd.BeginPrint +=new System.Drawing.Printing.PrintEventHandler(Pd_BeginPrint);
Pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Pd_PrintPage);
Pd.EndPrint += new System.Drawing.Printing.PrintEventHandler(Pd_EndPrint);
Pd.Print();
...the events will now fire, providing your print document is set up. However they wont fire when you click print inside internet explorer
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi Guys,
Can someone help me,i need help with Regex.I want to validate a date in this format MM/YYYY,thus 02/2009,
Regards
Mninawa
|
|
|
|
|
|
ooo! you're good!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Finally someone noticed my brilliance! and I put it all down to knowing google!
|
|
|
|
|
hopingToCode wrote: I put it all down to knowing Kung Foo!
fixed it
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
how about...
^(0[1-9]|1[0-2])/[0-9]{4}$
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Regex:
\d{2}\/\d{4}
Code:
public static bool IsDate(string date)
{
return Regex.IsMatch(date, @"^(\d{2}\/\d{4})$");
}
|
|
|
|
|
Thanx Buddy you have saved my day.
Mninawa
|
|
|
|
|
From my side 5/5
|
|
|
|
|
You could always try a variation of this[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hello i need some experimented coder opinion about how to securise a c# server
1. i have a c# server listening public incoming soket on my computer (XP Windows)
so i have a port forwarded (86.123.xxx.xxx:666) in my gateway .
user are then able send me data . but i need know what are the risk of a such conection for my computer.
is there a way to block potential hacker attack?.
2.this server share (using soket) the IP with of all user (like a p2p machine).
what i want is encrypt the IP(s) in a XML and share the IP.XML with users.
i feel like it will not be hard for a hacker decrypt the IP.xml.
how can i max secure this stuff.
3.I know from my old programme experience that haker can read my C# code so
(like one of them(a friend lukily) success get my Sql password/user if i put it into the code).
how to well secure my c# code and make it not readable and where to put sensible string
like http://MydistanteSite/login.php or code for sql user =toto pass=123.
i feel like c# totaly unsecure rigth now may be i should switch lange for include sensible data in a public machine?
any security advise welcome^^
|
|
|
|
|
The .NET Framework has loads of Encryption classes. Use one of them.
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.”
|
|
|
|
|
Yess i know i encrypted ip in xml they look like this
<ip userip="xxxxMoooOOOO" <="" ip="">
but since .net encryption is well know i'm pretty sure haker have already theyr tool for decrypt that in a click i was hoping find something realy take a huge amout of time to decrypt so even when haker succes decrypte i can tell i win cuz i wasted
a month of his life^^.
i seen some tool on net for make c# source hard to read but no idea what is the best
or i can use all of them on an .exe.
making the code not understandable can help hiding that the .xml was even created on haker computer.
so for the opened port any danger?
|
|
|
|
|
The software you have seen is probably what is known as an Obfuscator.
Google for that word and you will get lots of hits. Most of the free ones would not deter a determined hacker but they would slow him/her down a bit.
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.”
|
|
|
|