TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thang Le
NA
6
1.5k
[C# Windows Forms] Open form in static main
Feb 11 2019 10:22 PM
Hi everybody.
I have 2 form : MainFrm is main form and Notification is form used to show notification.
In program.cs :
static
void
Main()
{
bool
result;
Mutex mutex =
new
Mutex(
true
,
"UniqueAppId"
,
out
result);
if
(!result)
{
//MainFrm.showNotification("KyAppAPI??????????");
//MessageBox.Show("KyAppAPI??????????");
Notification notiBox =
new
Notification();
notiBox.Show();
return
;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainFrm());
GC.KeepAlive(mutex);
}
[/CODE]
I use mutex to keep application run once. If application already running, form Notification will show.
But my code work not right, form Notification not shown.
In MainFrm, I has a static method showNotification (using Tulpep Notification). I try calling this method in static main, but it not working, too.
However, if I use MessageBox, it working fine.
I don't know where the problem is. Please help me.
Reply
Answers (
3
)
make attractive Graphs in window form application
a function to handle numbers this way