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

Setting focus to an MDI child not working

We have an MDI application that is not setting always setting focus to
the newly corrected MDI. It is creating the form and it is the topmost
but it does not have focus.

The code we are using to activate the MDI is something like the
following:

frmTest frm = new frmTest();
frm.MdiParent = this;
frm.Show();

I have tried calling frm.Activate() and Focus() but to no avail.
Creating a non-MDI works OK.
We are launching the MDI by double clicking on a DeveloperExpress
grid. However, if we use a context menu on the grid and go through
exactly the same handler code to open the form, then this works fine.

Therefore, I am not sure if it is a .NET problem, a DeveloperExpress
problem or what? I notice that in the newsgroup some other people were
having similar problems with focus on MDI child forms.
Nov 15 '05 #1
2 7367
Hi,

Seems like a DevExp problem because this does work fine in a normal
MDIParent-Child scenario.

However, make sure you are calling the Focus method of the Child Form after
its Show() method.

Another thing you may want to try is to set Focus to a control in the child
form. Suppose, the child form contains a textbox named TextBox1, then set
the following line after the call to the Show() method.
f.TextBox1.Focus();

Let me know if this was helpful.

-Prateek
"Mystery Man" <Pr************@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
We have an MDI application that is not setting always setting focus to
the newly corrected MDI. It is creating the form and it is the topmost
but it does not have focus.

The code we are using to activate the MDI is something like the
following:

frmTest frm = new frmTest();
frm.MdiParent = this;
frm.Show();

I have tried calling frm.Activate() and Focus() but to no avail.
Creating a non-MDI works OK.
We are launching the MDI by double clicking on a DeveloperExpress
grid. However, if we use a context menu on the grid and go through
exactly the same handler code to open the form, then this works fine.

Therefore, I am not sure if it is a .NET problem, a DeveloperExpress
problem or what? I notice that in the newsgroup some other people were
having similar problems with focus on MDI child forms.
Nov 15 '05 #2
Thanks Prattek.

I have already done as you suggested but to no avail.
"Prateek" <pr***********@rediffmail.com> wrote in message news:<OT**************@TK2MSFTNGP11.phx.gbl>...
Hi,

Seems like a DevExp problem because this does work fine in a normal
MDIParent-Child scenario.

However, make sure you are calling the Focus method of the Child Form after
its Show() method.

Another thing you may want to try is to set Focus to a control in the child
form. Suppose, the child form contains a textbox named TextBox1, then set
the following line after the call to the Show() method.
f.TextBox1.Focus();

Let me know if this was helpful.

-Prateek
"Mystery Man" <Pr************@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
We have an MDI application that is not setting always setting focus to
the newly corrected MDI. It is creating the form and it is the topmost
but it does not have focus.

The code we are using to activate the MDI is something like the
following:

frmTest frm = new frmTest();
frm.MdiParent = this;
frm.Show();

I have tried calling frm.Activate() and Focus() but to no avail.
Creating a non-MDI works OK.
We are launching the MDI by double clicking on a DeveloperExpress
grid. However, if we use a context menu on the grid and go through
exactly the same handler code to open the form, then this works fine.

Therefore, I am not sure if it is a .NET problem, a DeveloperExpress
problem or what? I notice that in the newsgroup some other people were
having similar problems with focus on MDI child forms.

Nov 15 '05 #3

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

Similar topics

9
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a...
20
by: Arne | last post by:
During testing <div style="overflow:auto;"> in CSS I noticed the mousewheel would work in Mozilla only after I made a <a href="#">some text</a> link and clicked on that, within the div. It...
1
by: tdmailbox | last post by:
Is there a vb command that can tell me if I have focus in the child or parent form? Basicly I have a search macro that needs me to have focus to any field in the parent form. If my focus is set...
2
by: Sridhar | last post by:
Hi, I have a question. I have created a user control which contains a textbox and a button. we will enter some search word in the textbox and hit the button. Then we will get a pop-up with the...
9
by: Dick | last post by:
How do I set the focus to a control that is a child to a FormView? I've tried the obvious (below) and lots of variations but none seam to work! Sub Page_Load(ByVal sender As Object, ByVal e As...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for...
5
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered...
4
by: Spizzat2 | last post by:
I'm trying to figure out a workaround to a minor annoyance that I'm coming up with while coding a site. I've got some keyboard shortcuts set up for the site via javascript, and when I press escape,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.