Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: DllImport Pin
half-life18-Jun-08 4:00
half-life18-Jun-08 4:00 
Question.NET Remoting : 1 Client -> X Server Pin
stancrm18-Jun-08 0:33
stancrm18-Jun-08 0:33 
AnswerRe: .NET Remoting : 1 Client -> X Server Pin
joemonvarghese80@yahoo.co.in18-Jun-08 2:14
joemonvarghese80@yahoo.co.in18-Jun-08 2:14 
QuestionWhy Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 0:30
Rafferty Uy18-Jun-08 0:30 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Simon P Stevens18-Jun-08 0:47
Simon P Stevens18-Jun-08 0:47 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
ajtunbridge18-Jun-08 3:43
ajtunbridge18-Jun-08 3:43 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Karthik Kalyanasundaram18-Jun-08 4:21
Karthik Kalyanasundaram18-Jun-08 4:21 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 15:21
Rafferty Uy18-Jun-08 15:21 
Hi all,

Thanks to everyone who replied. I tried calling this.BringToFront() in the MainForm's constructor and Load event but it still didn't work.
Here are some code:

Program.cs
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
  Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);
  Application.Run(new MainForm());
}


MainForm.cs
/// <summary>
/// Initializes a new instance of the <see cref="MainForm" /> class.
/// </summary>
public MainForm()
{
  Splasher.Show(typeof (ProgressSplashForm));
            
  Splasher.Status = "Initializing components...";
  InitializeComponent();

  Splasher.ProgressValue = 80;
  ApplicationSession.Instance.PercentHoursBeforeAlert =
    Properties.Settings.Default.PercentHoursBeforeAlert;
  ApplicationSession.Instance.PercentHoursBeforeHighAlert =
    Properties.Settings.Default.PercentHoursBeforeHighAlert;

  Splasher.ProgressValue = 85;
  ApplicationSession.Instance.DbManager = new MsAccessDbManager(Application.StartupPath);
  RefreshAvailableFunctions(false);
            
  Splasher.Status = "Initialization completed.";
  Splasher.ProgressValue = 100;
  Splasher.Close();

  this.BringToFront();
  this.Activate();
}

/// <summary>
/// Handles the Load event of the MainForm control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param>
private void MainForm_Load(object sender, EventArgs e)
{
  this.BringToFront();
  this.Activate();
}


I also noticed that the this.IsHandleCreated and this.CanFocus properties are false in both the constructor and the load event.

*Note: The Splasher class is inspired by cncx's article[^] about splash screens. Sufficed to say, the Splasher.Show() method displays the splash screen by running a new application (Application.Run(_splashForm)).

Any ideas?

Rafferty

GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 15:45
Rafferty Uy18-Jun-08 15:45 
GeneralRe: Why Won't My MainForm Focus/Activate? [modified] Pin
Simon P Stevens18-Jun-08 22:16
Simon P Stevens18-Jun-08 22:16 
GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy19-Jun-08 0:52
Rafferty Uy19-Jun-08 0:52 
GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Simon P Stevens19-Jun-08 1:47
Simon P Stevens19-Jun-08 1:47 
QuestionAppDomain for unloading an assembly Pin
elektrowolf18-Jun-08 0:21
elektrowolf18-Jun-08 0:21 
AnswerRe: AppDomain for unloading an assembly Pin
Simon P Stevens18-Jun-08 0:29
Simon P Stevens18-Jun-08 0:29 
GeneralRe: AppDomain for unloading an assembly Pin
elektrowolf18-Jun-08 0:31
elektrowolf18-Jun-08 0:31 
GeneralRe: AppDomain for unloading an assembly Pin
Simon P Stevens18-Jun-08 0:38
Simon P Stevens18-Jun-08 0:38 
GeneralRe: AppDomain for unloading an assembly Pin
Simon P Stevens18-Jun-08 0:43
Simon P Stevens18-Jun-08 0:43 
GeneralRe: AppDomain for unloading an assembly Pin
elektrowolf18-Jun-08 2:04
elektrowolf18-Jun-08 2:04 
QuestionGeneric type should accept only delegate types Pin
N a v a n e e t h17-Jun-08 23:39
N a v a n e e t h17-Jun-08 23:39 
AnswerRe: Generic type should accept only delegate types Pin
Pete O'Hanlon18-Jun-08 0:13
mvePete O'Hanlon18-Jun-08 0:13 
GeneralRe: Generic type should accept only delegate types Pin
N a v a n e e t h18-Jun-08 0:43
N a v a n e e t h18-Jun-08 0:43 
AnswerRe: Generic type should accept only delegate types Pin
led mike18-Jun-08 5:18
led mike18-Jun-08 5:18 
GeneralRe: Generic type should accept only delegate types Pin
N a v a n e e t h18-Jun-08 6:43
N a v a n e e t h18-Jun-08 6:43 
QuestionIFormatProvider.GetFormat Pin
George_George17-Jun-08 23:08
George_George17-Jun-08 23:08 
AnswerRe: IFormatProvider.GetFormat Pin
Simon P Stevens17-Jun-08 23:19
Simon P Stevens17-Jun-08 23:19 

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.