473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

New Form

Hi.

I want to create a kind of configuration window. So, I have a main window,
and when I click on a button, it opens a new form.

But, because it is a configuration window, I would like that window to be
alway on top (of my application).

How can I do that ?

Thanks.
Nov 16 '05 #1
6 1979

"Mathieu Chavoutier" <no****@no.spam> a écrit dans le message de
news:O7**************@TK2MSFTNGP12.phx.gbl...
Hi.

I want to create a kind of configuration window. So, I have a main window,
and when I click on a button, it opens a new form.

But, because it is a configuration window, I would like that window to be
alway on top (of my application).

How can I do that ?


popup.TopMost = true;

Sorry.
Nov 16 '05 #2
Mathieu Chavoutier wrote:
Hi.

I want to create a kind of configuration window. So, I have a main window,
and when I click on a button, it opens a new form.

But, because it is a configuration window, I would like that window to be
alway on top (of my application).

How can I do that ?

Thanks.


When you say "I would like that window to be always on top" are you
saying that the application needs to keep on responding while the
configuration window is open?

If you are, set the TopMost property of the Form you are creating to
true before showing it.

If you're actually talking about displaying a Modal window (which I
suspect you are), use the Form's ShowDialog() method to block until the
Form has closed.

--

Ed Courtenay
[MCP, MCSD]
http://www.edcourtenay.co.uk
Nov 16 '05 #3

"Ed Courtenay" <re*****************************@edcourtenay.co.uk > a écrit
dans le message de news:OA*************@TK2MSFTNGP12.phx.gbl...
When you say "I would like that window to be always on top" are you
saying that the application needs to keep on responding while the
configuration window is open?
When the configuration window is open, I want it to be on top, and the other
would
be locked.
If you are, set the TopMost property of the Form you are creating to
true before showing it.
It locks the main window, so yes :o)
If you're actually talking about displaying a Modal window (which I
suspect you are), use the Form's ShowDialog() method to block until the
Form has closed.


What do you mean by "Modal window" ?

I have tried the TopMost property, and it locks the main window, but it
seems that your solution is doing the same. So, I will take a look at
ShowDialog(), and see if I have another question :o)

Thanks.
Nov 16 '05 #4

"Mathieu Chavoutier" <no****@no.spam> a écrit dans le message de
news:uh**************@TK2MSFTNGP10.phx.gbl...

What do you mean by "Modal window" ?

I have tried the TopMost property, and it locks the main window, but it
seems that your solution is doing the same. So, I will take a look at
ShowDialog(), and see if I have another question :o)


I have read the documentation, and now I use ShowDialog.

I thank you, and next time, I will try to read documentation before asking
question.
Nov 16 '05 #5
Mathieu Chavoutier wrote:
"Ed Courtenay" <re*****************************@edcourtenay.co.uk > a écrit
dans le message de news:OA*************@TK2MSFTNGP12.phx.gbl...
When you say "I would like that window to be always on top" are you
saying that the application needs to keep on responding while the
configuration window is open?

When the configuration window is open, I want it to be on top, and the other
would
be locked.

If you are, set the TopMost property of the Form you are creating to
true before showing it.

It locks the main window, so yes :o)


TopMost does not 'lock' the main window
If you're actually talking about displaying a Modal window (which I
suspect you are), use the Form's ShowDialog() method to block until the
Form has closed.

What do you mean by "Modal window" ?

I have tried the TopMost property, and it locks the main window, but it
seems that your solution is doing the same. So, I will take a look at
ShowDialog(), and see if I have another question :o)

Thanks.


Try this for an example:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WinScratch
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(96, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Show Modal";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(112, 8);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(96, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Show TopMost";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(216, 38);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
Form newForm = new Form();

newForm.Text = "Modal Window";

newForm.ShowDialog();
}

private void button2_Click(object sender, System.EventArgs e)
{
Form newForm = new Form();

newForm.Text = "TopMost Form";
newForm.TopMost = true;

newForm.Show();
}
}
}
--

Ed Courtenay
[MCP, MCSD]
http://www.edcourtenay.co.uk
Nov 16 '05 #6

"Ed Courtenay" <re*****************************@edcourtenay.co.uk > a écrit
dans le message de news:eW*************@TK2MSFTNGP12.phx.gbl...
Mathieu Chavoutier wrote:
"Ed Courtenay" <re*****************************@edcourtenay.co.uk > a écrit dans le message de news:OA*************@TK2MSFTNGP12.phx.gbl...
When you say "I would like that window to be always on top" are you
saying that the application needs to keep on responding while the
configuration window is open?

When the configuration window is open, I want it to be on top, and the other would
be locked.

If you are, set the TopMost property of the Form you are creating to
true before showing it.

It locks the main window, so yes :o)


TopMost does not 'lock' the main window

[...] Try this for an example:


Ok, I have seen the difference, in TopMost, you can still select the main
window. Not with ShowDialog.

Thank you :o)
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John | last post by:
Dear all, It been more than 3 days I am trying to debug this program, I interpret it using activePerl and it is giving (perl -wc code_process.pl) no error syntax but when I put it online, change...
5
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
4
by: Targa | last post by:
Trying to total some price fields in a form but doesnt work when all the referenced form fields dont exisit. This is for an invoice - pulled prom a database and the form doesnt always contain the...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
19
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
6
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
5
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.