|
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (richTextResult.Text != string.Empty)
{
DialogResult answer;
string message1 = "Are you sure you want to exit the program? " +
"\n\nThe information in your Result box will be lost!";
answer = MessageBox.Show(message1, "Exit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (answer == DialogResult.No)
{
e.Cancel = true;
}
else
{
ResetDatabaseActivity();
Application.Exit();
}
}
}
I know nothing , I know nothing ...
|
|
|
|
|
Hello Stark,
Thank you for your reply. No, unfortunately, the alreadyClosing bool is required. When the application closes, if it is not in place, it trys to run this code twice. This switch is just a stop measure. It's not a big issue, but it takes 2 clicks to close the question box. That is the only reason that it is there. However, I just realized that Application.Exit() call is not required at all, since it is already staring to close before the call. Sometimes (Pat) cannot see the forest through the trees. I removed it and the problem has been solved. Thank you for your thoughts and input. I appreciate it. Best Regards, Pat
|
|
|
|
|
Hi!!
i'm back to disturb u again...
This time i wanna know y cant i use System.windows in a console program..
wheneva i type this it shows error.. that it doesn't exists.. but when i choose window application. i uses it...
help me out..i need to use it...
|
|
|
|
|
You need to add it as a reference. By default, it doesn't get added to console applications. Why would it? They aren't responsible for drawing windows after all.
"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
|
|
|
|
|
how???
i m working on keyloggers... so need to write a console program for it...
thats y...
i'm using System.Windows.Forms.Keys... but cant use it...
as mentioned...
|
|
|
|
|
In your solution explorer, right-click References (looks like a folder), Add Reference. Then find the one you need.
I will advise you that using keyloggers maliciously (such as to spy on someone, steal passwords etc) is ill-advised, and probably illegal.
|
|
|
|
|
A console application does not include Windows by default. You need to add it to the References section of your project in order to use it. However, if you are developing an application that needs Windows why would you start with a console app?
It's time for a new signature.
|
|
|
|
|
sir, thats m asking.. how shud i... actually i'm new to VS2008 and C#.. thats y stuck here...
|
|
|
|
|
Well, I wonder how you expect to write a working application if you do not understand the basics.
However
- Use your mouse to right-click on the References item in Solution Explorer.
- Select the .NET tab in the popup dialog.
- Scroll down to System.Windows.Forms, and select it.
- Click on OK.
- Add the
using statement to your source module.
[edit]Did I say something wrong here? Got a 1 vote for it anyway[/edit]
It's time for a new signature.
modified on Thursday, July 1, 2010 1:57 PM
|
|
|
|
|
I have noticed that some people down-vote things they don't want to hear, regardless of veracity or technical merit.
I wouldn't let it get you down.
|
|
|
|
|
Timothy CIAN wrote: I wouldn't let it get you down.
Oh, it doesn't; I make too many mistakes to worry about criticism. I would just prefer to have an explanation of what I did wrong.
It's time for a new signature.
|
|
|
|
|
i found an answer...
right click on the solution and then add reference of System.Windows.Forms
this solves my problem..
|
|
|
|
|
How to extend fixed scope?
I've got array of byte* native pointers and I need to assign them managed byte[] arrays. But that can be done in a fixed {} block statement.
Чесноков
|
|
|
|
|
You can get a permanent fix through the GCHandle class. It is used in here[^] for passing arrays.
|
|
|
|
|
that is what I was looking for, thanks
Чесноков
|
|
|
|
|
you're welcome.
|
|
|
|
|
Hi Experts,
I am new to C#,I am trying to use
HashSet stringSet = new HashSet { "abc", "aa" };
Bu i am getting error as "A new expression requires () or [] after type"
Whethier i should include any header file.
Thanks
Raj
|
|
|
|
|
try this:
HashSet<string> stringSet = new HashSet<string> { "abc", "aa" } ;
|
|
|
|
|
HashSet<string> stringSet = new HashSet<string>() { "abc", "aa" };
foreach (string s in stringSet) log(s);
works well on .NET 3.5 or 4.0
FWIW: the constructor parentheses are optional here!
|
|
|
|
|
Hi sir,
I tried the above but i am getting error as "{ "abc", "aa" };"
For this line ,its getting error
Error 1 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 63 WindowsApplication1
Error 2 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 70 WindowsApplication1
Error 3 Invalid expression term ',' E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 70 WindowsApplication1
Error 4 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 72 WindowsApplication1
Error 5 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 77 WindowsApplication1
|
|
|
|
|
|
The collection initializer syntax "new X { elements } " is new in C# 3.0. The error message looks like you're using a C# 2.0 compiler (VS 2005?).
You could rewrite this snippet to C# 2.0 by using explicit calls to Add(), but that still won't help you as the HashSet class is new in .NET 3.5 as well.
HashSet<string> stringSet = new HashSet<string>();
stringSet.Add("abc");
stringSet.Add("aa");
|
|
|
|
|
Hi
I have a libary with some user controls which are used on different projects. What i want to do is when one of these controls are place on a form, you have to set the controls name before its added to the project. Is this possible at all.
Thanks
Chris
Chris
|
|
|
|
|
hiiiii,
for me it sounds you developed your own Designer ?!??
in that case you need to implemented the INameCreationService.
|
|
|
|
|
hi
No i havent developed my own designer. Just that i want to be promted to input the controls name
Chris
|
|
|
|