473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display a dialog once my main form is showing?

I have a C# form application. Once my main window is showing I want to
pop-up a login type dialog. What event would I trap to affect this? I
tried handling the form load but the main form window is not yet visible
then.

Thanks!

Grant Schenck
Nov 17 '05 #1
4 3009
Grant,

You will want to use the Activated event to handle this. First, you
have to define a flag in your class:

// Default to false, indicating that the form is not activated for the first
time.
private bool firstTimeActiva tion = true;

Then, you have to handle the Activated event:

// If the flag is true, then show your login form.
if (firstTimeActiv ation)
{
// Set the flag to false here. The reason for this is that when
// your login form is closed, this form will activate again, and
// this will be called again before you exit this block for the first
// time.
firstTimeActiva tion = !firstTimeActiv ation;

// Show your login form here.
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Grant Schenck" <sc******@opton line.net> wrote in message
news:eM******** *****@TK2MSFTNG P09.phx.gbl...
I have a C# form application. Once my main window is showing I want to
pop-up a login type dialog. What event would I trap to affect this? I
tried handling the form load but the main form window is not yet visible
then.

Thanks!

Grant Schenck

Nov 17 '05 #2
There are many events which are fired while the form is getting loaded, painted:

Activated, GotFocus, LayOut.... Please consult MSDN for type Form and have a look at the Event section.

HTH, Metallikanz!

"Grant Schenck" <sc******@opton line.net> wrote in message news:eM******** *****@TK2MSFTNG P09.phx.gbl...
I have a C# form application. Once my main window is showing I want to
pop-up a login type dialog. What event would I trap to affect this? I
tried handling the form load but the main form window is not yet visible
then.

Thanks!

Grant Schenck

Nov 17 '05 #3
Thank you!

That did the trick.

Grant Schenck

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:#m******** ******@TK2MSFTN GP10.phx.gbl...
Grant,

You will want to use the Activated event to handle this. First, you
have to define a flag in your class:

// Default to false, indicating that the form is not activated for the first time.
private bool firstTimeActiva tion = true;

Then, you have to handle the Activated event:

// If the flag is true, then show your login form.
if (firstTimeActiv ation)
{
// Set the flag to false here. The reason for this is that when
// your login form is closed, this form will activate again, and
// this will be called again before you exit this block for the first
// time.
firstTimeActiva tion = !firstTimeActiv ation;

// Show your login form here.
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Grant Schenck" <sc******@opton line.net> wrote in message
news:eM******** *****@TK2MSFTNG P09.phx.gbl...
I have a C# form application. Once my main window is showing I want to
pop-up a login type dialog. What event would I trap to affect this? I
tried handling the form load but the main form window is not yet visible
then.

Thanks!

Grant Schenck


Nov 17 '05 #4
Hi,

It does depend if you want to have the back window visible or not, if not
use Load ( the good thing of this one is that it fires only once ) if you
want it visible you could follow Nicholas's suggestion.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Grant Schenck" <sc******@opton line.net> wrote in message
news:eM******** *****@TK2MSFTNG P09.phx.gbl...
I have a C# form application. Once my main window is showing I want to
pop-up a login type dialog. What event would I trap to affect this? I
tried handling the form load but the main form window is not yet visible
then.

Thanks!

Grant Schenck

Nov 17 '05 #5

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

Similar topics

1
4751
by: Dalan | last post by:
I designed a dialog box with a combo to select individual vendors from a form and its related data for print ouput. Though the dialog box seems to work okay, I apparently do not have the filtering code behind the OnOpen Event Procedure of the report structured correctly. Anyone's assistance will be appreciated, although I would like to stay on the same track. Here is what I have done: 1. Created a new vendor query (qryVendorRpt) with...
0
8410
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record number changes fine. Within this main form I have a subform detailing distribution records for the contact (main form is based on this) that also has navigation buttons and a label showing Distribution 1 of ##. This is where the problem lies. The...
3
10666
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to browse/add one picture at a time to a system. Now he would like to 'view' all of the thumbnails associated with any system on a single form. I can setup a main/subform scenario, but how do I show all of the pictures as thumbnails. I was using the...
4
11622
by: Alexander | last post by:
Hi, I have written a program that takes on some operations much more time than I expected. As I have seen users clicking wildly on the screen to make something happen, I want to follow the microsoft principles: always show them something ;) First I made up a little status dialog containing a gif image to show a little animation and a TextBox for a changing status message during the work of the main program. Just showing the dialog box...
5
1877
by: John | last post by:
Hi How can I show a dialog from within the main form? frmdialog.show? Thanks Regards
7
4635
by: Peter | last post by:
I have a primary form named frmMain. During some extended data pulls I launch another Dialog Form named frmUpdating. How do I keep the frmUpdating centered on the frmMain if a user moves the frmMain form? -Peter
1
1026
by: | last post by:
Hi all, I would like to call a dialog form from the main form, just after the main form is loaded. however, if i put the code at either Form_Load or FormActivate, they both cannot achieve it, as the main form is not visible yet, and with the dialog form showing.. Any idea on how to implement this?
4
2224
by: forest demon | last post by:
i've seen previous posts somewhat related to this, so i apologize if this is redundant. I have a main form with separate threads. When showing a dialog like <dialog>.ShowDialog(), it functions as a non-modal instead of modal. any help is appreciated, thanks.
0
1902
by: =?Utf-8?B?a20=?= | last post by:
I've got a simple C# app built in VS2005. When I click a menu item a modal form opens and performs a lengthy operation in the Load event handler to populate a text control, so it takes a few seconds before the modal form is actually displayed. I would like to change the cursor to the WaitCursor between the time that the menu item is clicked and the modal form is actually visible. I've tried setting the form's cursor in the Load event...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
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
9873
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
8891
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
7420
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
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.