473,320 Members | 1,939 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.

Set focus

Hi

I have a form with a tab control which has a text box. When the form loads I
would like the text box to have the focus. In the form load event I placed
mytxt.focus() as the last line. When I run the form the focus is always on
the tab of the tab control. What am I doing wrong?

Regards

PS: I am using infragistics controls, in case their behaviour is different
from standard controls.

Nov 20 '05 #1
4 2893
Put this in the Activated Event

me.YourTextBoxName.focus()
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi

I have a form with a tab control which has a text box. When the form loads I would like the text box to have the focus. In the form load event I placed
mytxt.focus() as the last line. When I run the form the focus is always on
the tab of the tab control. What am I doing wrong?

Regards

PS: I am using infragistics controls, in case their behaviour is different
from standard controls.

Nov 20 '05 #2
* "John" <jo**@nospam.infovis.co.uk> scripsit:
I have a form with a tab control which has a text box. When the form loads I
would like the text box to have the focus. In the form load event I placed
mytxt.focus() as the last line. When I run the form the focus is always on
the tab of the tab control. What am I doing wrong?


The focus can only be set to visible controls. In the form's 'Load'
event handler, the form and the controls are not visible and setting the
focus won't work. You can set the focus to the control by assigning the
lowest tab index to the control that should initially have the focus.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Or the TabControl.GotFocus() Event

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
Put this in the Activated Event

me.YourTextBoxName.focus()
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi

I have a form with a tab control which has a text box. When the form loads
I
would like the text box to have the focus. In the form load event I

placed mytxt.focus() as the last line. When I run the form the focus is always on the tab of the tab control. What am I doing wrong?

Regards

PS: I am using infragistics controls, in case their behaviour is different from standard controls.


Nov 20 '05 #4
VJ
Another way to do is use the "SelectControl". This will move the focus to
the control. I have never done this in form Load.

VJ

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi

I have a form with a tab control which has a text box. When the form loads I would like the text box to have the focus. In the form load event I placed
mytxt.focus() as the last line. When I run the form the focus is always on
the tab of the tab control. What am I doing wrong?

Regards

PS: I am using infragistics controls, in case their behaviour is different
from standard controls.

Nov 20 '05 #5

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

Similar topics

4
by: Nitin | last post by:
Hi I have created function to check date and time. at the time of execution, if date is left empty the function returns the error message but then the focus goes to next field. Next filed is for...
2
by: Peter Wright | last post by:
Hi all. Hopefully this should demonstrate the problem I'm having: http://flooble.net/~pete/focus-problem-demo/ (I'm testing it in Mozilla only, but I'm not sure if it's actually a...
3
by: VA | last post by:
t=document.getElementById('mytable') is a HTML table with some input fields in its cells Why doesnt t.getElementsByTagName('tr').firstChild.focus; put the focus on that text field? It...
17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
1
by: avnrao | last post by:
Hi, I am facing a problem with control.focus (javascript). Here is the description of the issue. 1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on this, will redirect...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
7
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click'...
4
by: Roger | last post by:
Hi, I am confused about the differences between this.window.focus(), window.focus(), and this.focus(). I want to use the calls in a <body onload="..."tag. What are the differences between...
3
by: jp2express | last post by:
I have several applications that use panels as screens, but I can *not* seem to set the focus for a Textbox. Panel1.BringToFront() Panel1_Textbox.Focus() ' do something with a control on Panel1...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
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: 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...
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.