Click here to Skip to main content
15,902,635 members
Home / Discussions / C#
   

C#

 
GeneralRe: adding item to listbox Pin
cpkilekofp29-Sep-08 11:34
cpkilekofp29-Sep-08 11:34 
GeneralRe: adding item to listbox Pin
cpkilekofp29-Sep-08 4:32
cpkilekofp29-Sep-08 4:32 
GeneralRe: adding item to listbox Pin
netJP12L29-Sep-08 4:57
netJP12L29-Sep-08 4:57 
Questionreg expression Pin
nesfrank22-Sep-08 6:23
nesfrank22-Sep-08 6:23 
AnswerRe: reg expression Pin
Daniel Grunwald22-Sep-08 6:54
Daniel Grunwald22-Sep-08 6:54 
GeneralRe: reg expression Pin
nesfrank22-Sep-08 7:50
nesfrank22-Sep-08 7:50 
GeneralRe: reg expression Pin
Daniel Grunwald22-Sep-08 7:54
Daniel Grunwald22-Sep-08 7:54 
QuestionShowDialog method not showing the popup in foreground. Pin
PrashantGadhave22-Sep-08 4:45
PrashantGadhave22-Sep-08 4:45 
Hi all, I am reposting this.Yesterday Mika had given me a solution, but for some reasons I can't do it that way because of some design constraints, and I have to do it this way only.

I have a form 'frmProgressBar', which is shown as popup using objfrmProgressBar.showDialog() from a class AppGlobals (AppGlobals.prpgressbar.show() method). frmProgressBar has a backgroundworker thread running, which keeps running till the processing in other forms is not compleated. I want to hide popup whenever the main form, on which other controls are loaded, is minimised and the popup is getting hidden also. But the problem is, when the main form is maximized, I want to show the popup form again. I checked !IsDestroyed for frmProgressBar which returns false, so the backgroundworker thread is still running, but the popup is not displayed in the foreground, only main form is shown. I tried Show(), BringToFront(), TopLayer = True, but nothing seems to work. Any help please.It is very urgent.

Following is my code :

bool bContinue = true;
public frmProgressBar(string Message)
{
	InitializeComponent();
	this.ShowInTaskbar = false;
	lblMessage.Text = Message ;
	backgroundWorker = new BackgroundWorker();
	backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork);
	backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler (backgroundWorker_RunWorkerCompleted);
}

//This is called when my main window is resized event us fired
private void setWindowStateAccordingToMainForm(FormWindowState State)
{
	if (this.InvokeRequired)
	{
		setWindowState d = new setWindowState(setWindowStateAccordingToMainForm);
		this.Invoke(d, new object[] { State });
	}
	else
	{
		if ((State == FormWindowState.Maximized) || (State == FormWindowState.Normal))
		{
			if (!this.IsDisposed)
			{
				WindowState = FormWindowState.Maximized;
				Show();
			}
		}
		else if (State == FormWindowState.Minimized)
		{
			if (!this.IsDisposed)
			{
				WindowState = FormWindowState.Minimized;
				Hide();
			}
		}
	}
}

void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
	this.Close();
	this.Dispose();
}

void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
	while (bContinue)
	{
	}
} 

AnswerRe: ShowDialog method not showing the popup in foreground. Pin
Thomas Stockwell22-Sep-08 6:03
professionalThomas Stockwell22-Sep-08 6:03 
AnswerRe: ShowDialog method not showing the popup in foreground. Pin
Paul Conrad22-Sep-08 6:36
professionalPaul Conrad22-Sep-08 6:36 
GeneralRe: ShowDialog method not showing the popup in foreground. Pin
PrashantGadhave22-Sep-08 6:54
PrashantGadhave22-Sep-08 6:54 
Questionwork with a ssh connection Pin
caradri22-Sep-08 4:45
caradri22-Sep-08 4:45 
AnswerRe: work with a ssh connection Pin
Paul Conrad22-Sep-08 6:35
professionalPaul Conrad22-Sep-08 6:35 
RantRe: work with a ssh connection Pin
caradri22-Sep-08 18:51
caradri22-Sep-08 18:51 
QuestionHow do I set the location of a form? Pin
arnold_w22-Sep-08 4:06
arnold_w22-Sep-08 4:06 
AnswerRe: How do I set the location of a form? Pin
Caio Kinzel Filho22-Sep-08 4:17
Caio Kinzel Filho22-Sep-08 4:17 
AnswerRe: How do I set the location of a form? Pin
DaveyM6922-Sep-08 4:28
professionalDaveyM6922-Sep-08 4:28 
AnswerRe: How do I set the location of a form? Pin
Nouman Bhatti22-Sep-08 7:44
Nouman Bhatti22-Sep-08 7:44 
AnswerRe: How do I set the location of a form? Pin
arnold_w22-Sep-08 21:35
arnold_w22-Sep-08 21:35 
QuestionManagementObject Pin
arkiboys22-Sep-08 3:55
arkiboys22-Sep-08 3:55 
AnswerRe: ManagementObject Pin
Mark Salsbery22-Sep-08 6:35
Mark Salsbery22-Sep-08 6:35 
GeneralRe: ManagementObject Pin
arkiboys22-Sep-08 21:09
arkiboys22-Sep-08 21:09 
GeneralRe: ManagementObject Pin
Mark Salsbery23-Sep-08 8:45
Mark Salsbery23-Sep-08 8:45 
GeneralRe: ManagementObject [modified] Pin
arkiboys23-Sep-08 20:52
arkiboys23-Sep-08 20:52 
GeneralRe: ManagementObject Pin
Mark Salsbery24-Sep-08 4:55
Mark Salsbery24-Sep-08 4:55 

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.