473,322 Members | 1,421 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,322 software developers and data experts.

handling the focus between two windows forms

Eps
I have two win forms in my app, one for the main gui and another for an
options screen, I also have an ini file which is loaded in after the
InitializeComponent(); is called. If there is no directory set in the
ini file then an instance of the option screen is autmatically created.
This all works fine except the options win form is always behind the
main gui, I have been playing with the various methods Activate(),
Focus(), etc but I can't get my options screen to come on top.

Any help appreciated.

--
Eps

http://ukcomment.blogspot.com/

A UK political Blog
Nov 17 '05 #1
3 3160
hi,

Post some code , probably it's cause you create it before the main form,
what if you set a flag when there is no dir set in the ini file and then in
the main's Form_load event you check for it and if set create * show the
second form , also are you using Hide() on the second form ? or just
creating it each time you need it?

cheers,

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

"Eps" <ep*@mailinator.com> wrote in message
news:d4**********@domitilla.aioe.org...
I have two win forms in my app, one for the main gui and another for an
options screen, I also have an ini file which is loaded in after the
InitializeComponent(); is called. If there is no directory set in the ini
file then an instance of the option screen is autmatically created. This
all works fine except the options win form is always behind the main gui, I
have been playing with the various methods Activate(), Focus(), etc but I
can't get my options screen to come on top.

Any help appreciated.

--
Eps

http://ukcomment.blogspot.com/

A UK political Blog

Nov 17 '05 #2
I would also suggest, given what I know of what you're trying to
achieve, that you want to use .ShowDialog(), not .Show() to show the
options dialog.

That would prevent the user from doing anything with the main form
until after they have dismissed the options dialog.

Nov 17 '05 #3
Eps
Bruce Wood wrote:
I would also suggest, given what I know of what you're trying to
achieve, that you want to use .ShowDialog(), not .Show() to show the
options dialog.


yep showdialog() sorted it all out, thanks a lot.

--
Eps

http://ukcomment.blogspot.com/

A UK political Blog
Nov 17 '05 #4

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

Similar topics

0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
0
by: Miquel | last post by:
Hi all. I felt frustrated when developing an 'UserControl' derivated from textBox, because sequence event (and Validate event) seems to fail. I Always thought my code was wrong. But after...
9
by: Lars Netzel | last post by:
If I press the Key "a" on the keyboard, all the events and properites will only give me "65" as keycode.. and I want it to give me "a". If I use the KeyPress event.. then I will have access to...
8
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control...
2
by: majeti | last post by:
handling the focus between two windows forms
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.