Click here to Skip to main content
15,915,600 members
Home / Discussions / C#
   

C#

 
QuestionSetting a variable value from an array. Pin
jblouir5-Jun-07 5:42
jblouir5-Jun-07 5:42 
AnswerRe: Setting a variable value from an array. Pin
Giorgi Dalakishvili5-Jun-07 5:56
mentorGiorgi Dalakishvili5-Jun-07 5:56 
GeneralRe: Setting a variable value from an array. Pin
jblouir5-Jun-07 6:21
jblouir5-Jun-07 6:21 
AnswerRe: Setting a variable value from an array. Pin
Hesham Yassin6-Jun-07 8:06
Hesham Yassin6-Jun-07 8:06 
QuestionApplication is closing when i hide it...! Pin
Affan Toor5-Jun-07 5:37
Affan Toor5-Jun-07 5:37 
AnswerRe: Application is closing when i hide it...! Pin
blakey4045-Jun-07 5:50
blakey4045-Jun-07 5:50 
AnswerRe: Application is closing when i hide it...! Pin
Luc Pattyn5-Jun-07 6:06
sitebuilderLuc Pattyn5-Jun-07 6:06 
GeneralRe: Application is closing when i hide it...! Pin
Affan Toor5-Jun-07 6:23
Affan Toor5-Jun-07 6:23 
Thanks for reply....here's some code of splash and main form...

Code for load event of splash form:

private void frmSplash_Load(object sender, EventArgs e)
{
// .....
// Some functions....
// .....
this.Hide();
Form objFrmMain = new frmMain();
objFrmMain.ShowDialog();
Application.Exit();
}

Code for resize event of main form:

private void frmMain_Resize(object sender, EventArgs e)
{
if (this == null)
{
return;
}

if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
notifyIcon1.Visible = true;
}
else
{
this.Show();
notifyIcon1.Visible = false;
}
}

Code for restoring the main form:

private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
ContextMenuStrip cms = new ContextMenuStrip();
cms = contextMenuStrip2;
cms.Items[0].Visible = true;
cms.Items[1].Visible = true;
}
else
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Show();
notifyIcon1.Visible = true;
this.WindowState = FormWindowState.Maximized;
}

// Activate the form.
this.Activate();
this.Focus();
}
}

Following is the code in Program.cs, this may also be useful...

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmSplash());
}

When i minimize the main form, frmMain_Resize event is executed and after this frmMain closes and the Application.Exit() is executed and application closes.

Hope this helps you understanding the ptoblem, looking forward for your reply...

Regards,
Affan Ahmad Toor

..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!

GeneralRe: Application is closing when i hide it...! Pin
Ian Shlasko5-Jun-07 7:06
Ian Shlasko5-Jun-07 7:06 
GeneralRe: Application is closing when i hide it...! Pin
Luc Pattyn5-Jun-07 7:44
sitebuilderLuc Pattyn5-Jun-07 7:44 
GeneralRe: Application is closing when i hide it...! Pin
Affan Toor6-Jun-07 2:03
Affan Toor6-Jun-07 2:03 
QuestionReagrding Xml serialization Pin
ksrs5-Jun-07 5:10
ksrs5-Jun-07 5:10 
AnswerRe: Reagrding Xml serialization Pin
Giorgi Dalakishvili5-Jun-07 5:40
mentorGiorgi Dalakishvili5-Jun-07 5:40 
QuestionRe: Reagrding Xml serialization Pin
ksrs5-Jun-07 6:45
ksrs5-Jun-07 6:45 
Questionvc++ to c# .NET Pin
Kabirdas Jaunjare5-Jun-07 5:05
Kabirdas Jaunjare5-Jun-07 5:05 
AnswerRe: vc++ to c# .NET Pin
originSH5-Jun-07 5:35
originSH5-Jun-07 5:35 
QuestionNewbie trying very hard not to pull my hair out!!! Pin
allan.gagnon5-Jun-07 4:59
allan.gagnon5-Jun-07 4:59 
AnswerRe: Newbie trying very hard not to pull my hair out!!! Pin
kubben5-Jun-07 5:36
kubben5-Jun-07 5:36 
Questionhow to sort an unbound column in datagridview Pin
ChupaChupa5-Jun-07 4:57
ChupaChupa5-Jun-07 4:57 
QuestionCheck type of object Pin
SVb.net5-Jun-07 4:18
SVb.net5-Jun-07 4:18 
AnswerRe: Check type of object Pin
Not Active5-Jun-07 4:25
mentorNot Active5-Jun-07 4:25 
AnswerRe: Check type of object Pin
Seishin#5-Jun-07 4:31
Seishin#5-Jun-07 4:31 
QuestionHow to create a custom ScrollBar with VisualStyles Pin
Juan Pablo G.C.5-Jun-07 3:44
Juan Pablo G.C.5-Jun-07 3:44 
QuestionAdding items to ListView Pin
Rajesh R Subramanian5-Jun-07 2:54
professionalRajesh R Subramanian5-Jun-07 2:54 
AnswerRe: Adding items to ListView Pin
teejayem5-Jun-07 3:05
teejayem5-Jun-07 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.