473,783 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1995

"Mathieu Chavoutier" <no****@no.spam > a écrit dans le message de
news:O7******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP10.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******** *****@TK2MSFTNG P12.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
configurati on 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.Collecti ons;
using System.Componen tModel;
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.Componen tModel.Containe r components = null;

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

//
// TODO: Add any constructor code after InitializeCompo nent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
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 InitializeCompo nent()
{
this.button1 = new System.Windows. Forms.Button();
this.button2 = new System.Windows. Forms.Button();
this.SuspendLay out();
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(8, 8);
this.button1.Na me = "button1";
this.button1.Si ze = new System.Drawing. Size(96, 23);
this.button1.Ta bIndex = 0;
this.button1.Te xt = "Show Modal";
this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);
//
// button2
//
this.button2.Lo cation = new System.Drawing. Point(112, 8);
this.button2.Na me = "button2";
this.button2.Si ze = new System.Drawing. Size(96, 23);
this.button2.Ta bIndex = 1;
this.button2.Te xt = "Show TopMost";
this.button2.Cl ick += new System.EventHan dler(this.butto n2_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(216, 38);
this.Controls.A dd(this.button2 );
this.Controls.A dd(this.button1 );
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayo ut(false);

}
#endregion

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

private void button1_Click(o bject sender, System.EventArg s e)
{
Form newForm = new Form();

newForm.Text = "Modal Window";

newForm.ShowDia log();
}

private void button2_Click(o bject sender, System.EventArg s 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******** *****@TK2MSFTNG P12.phx.gbl...
Mathieu Chavoutier wrote:
"Ed Courtenay" <re************ *************** **@edcourtenay. co.uk> a écrit dans le message de news:OA******** *****@TK2MSFTNG P12.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
configurati on 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
5652
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 to the appropriate mode and test the html form it gave me an 500 internel server error. I really need it to be done soon, I would not post here before I test it as much as I can,
5
6089
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 Internet. Specifically, marking up a document that will contain multiple related form controls (intended exclusively for client-side scripting) that would never be intended to be submitted. I realise that that concept is a non-starter in an Internet...
4
2131
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 same amount of Line Items. If I have all 20 Line Items, it works great. var sub1 = form.Line_Item_Subtotal1.value var sub2 = form.Line_Item_Subtotal2.value var sub3 = form.Line_Item_Subtotal3.value var sub4 = form.Line_Item_Subtotal4.value
25
10266
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 data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
19
3611
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 thing you know ;-) After discovering that access 2000 support form properties (I'm a
11
18837
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 they are too big and wind up covering up some of the fields on the main form. Is there any good code out there that works in a similar fashion that will also either a) stretch the form width wise on widescreens or b), rely on height rather than...
5
73215
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
3229
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
4580
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 forum). I don't use server controls in it (apart from Page). The problem occurs on the page where visitor can post a new messages. Basically, it's a form with couple of
5
3933
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 form, I trigger the on acitvate event to run a macro. I can use the Dlookup function to update my fields, which is OK. However, I intitially tried to use the Repaint Object command to repaint the form. That did not work. Though I solved the...
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.