I need to know that return parameters of SetSystemTime function (that has been located coredll.dll of windows ce 5.0 device) usually returns 1 return type uint. but sometimes i cannot set device time. Is there any idea ?
thanks to all
I am developing an application in c#,I have to select a file from PC and upload the file details to server.The file details incude filename,filetype,size etc.
In order to find filetype I need to detect MIMEType.
Please anybody help me.
This will either automatically create a copy of the constant before it's passed to the method, as a constant can not be changed, or it will produce a compilation error, as you have to copy the value yourself.
What it looks like you are trying to do from the code, is to make a constant argument, which is not supported in C#.
How to use const member function in C#.
Methods are always constant, you can never change the definition of a method at runtime.
Talking about the designers of C# making something complicated or what!
I have built a LogViewer application and my objective is to terminate the application if it determines there are no log files to display or if the logfile is in use by another application.
I run the application from Main as follows:
In MainForm, it first does InitializeComponent, then it Populates the LogSelector with some user choices and then it adds logging info to the appropriate control if a log file is available (DisplayLogInfo).
If DisplayLogInfo detects that no logfile is available or the logfile is being used by another app, I want LogViewer to not show any form and to terminate.
I have tried this.Hide(). I have tried Application.Exit(). I have tried to make the form invisible by setting this.Visible to false. I have tried this.Dispose(), but then I get an unhandled exception and would rather not handle the exception by ignoring it.
Regardless, the form always displays and I have to close the app via closing the Window by the Close button.
Can anyone suggest a way to get this to work.
I would rather not rewrite the app. so that it checks for the logfile before running InitializeComponent as I believe there must be a way to accomplish the task as I have written it and I would like to learn how it can be done.
First, I gave you bad (or at least incomplete) advice. I meant to say to use the Application.Idle event rather than the Load event. Calling Close from the Load event can cause a memory leak. You could do something like:
publicpartialclass MainForm : Form
InitializeComponent(); <br> <br>
// Code to determine whether to close form <br>if (ShouldClose)
Application.Idle += new EventHandler(Application_Idle);
} <br> <br>
void Application_Idle(object sender, EventArgs e)
The Hide and Close methods don't work in the constructor because the Form is still being constructed. And in any case you don't want to close the form at this point, assuming the calling code looks something like:
If MainForm is closed and disposed before it is constructed, then Application.Run will throw an ObjectDisposedException.