473,696 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Question of form focus - VB.NET 2003

Is there a way of stopping a form getting focus in VB.NET. The scenario I
have is a main form and a form used for display only. There are no user
controls on the display form and it does not ever need to have the focus.
When the displays on the form are updated it appears to get the focus. I
would like to prevent this because if the user operates any hot-keys
(thinking the main form still has focus) these keys will fail.

I have tried saving the display form's owner in a variable and then
executing the following in my UpdateDisplay method. However the focus
remains with the display form, when I had hoped it would be set to the main
form (the display forms owner).

mOwner.Select()

I have also tried:

mOwner.Focus()

Neither of which seem to work.

Many thanks,
Sid.
Apr 22 '06 #1
2 5398
Sid Price wrote:
Is there a way of stopping a form getting focus in VB.NET. The scenario I
have is a main form and a form used for display only. There are no user
controls on the display form and it does not ever need to have the focus.
When the displays on the form are updated it appears to get the focus. I
would like to prevent this because if the user operates any hot-keys
(thinking the main form still has focus) these keys will fail.

I have tried saving the display form's owner in a variable and then
executing the following in my UpdateDisplay method. However the focus
remains with the display form, when I had hoped it would be set to the main
form (the display forms owner).

mOwner.Select()

I have also tried:

mOwner.Focus()

Neither of which seem to work.

Many thanks,
Sid.


Just because you update some controls on a form it should not get focus.
You may want to show the code that causes the form to get focus.

Chris
Apr 22 '06 #2
"Chris" <no@spam.com> wrote in message
news:uP******** ******@TK2MSFTN GP05.phx.gbl...
Sid Price wrote:
Is there a way of stopping a form getting focus in VB.NET. The scenario I
have is a main form and a form used for display only. There are no user
controls on the display form and it does not ever need to have the focus.
When the displays on the form are updated it appears to get the focus. I
would like to prevent this because if the user operates any hot-keys
(thinking the main form still has focus) these keys will fail.

I have tried saving the display form's owner in a variable and then
executing the following in my UpdateDisplay method. However the focus
remains with the display form, when I had hoped it would be set to the
main form (the display forms owner).

mOwner.Select()

I have also tried:

mOwner.Focus()

Neither of which seem to work.

Many thanks,
Sid.


Just because you update some controls on a form it should not get focus.
You may want to show the code that causes the form to get focus.

Chris


This is the mothod that updates the controls on the form:

Private Sub UpdateDisplay()

Dim iSeconds As Integer = iValue Mod 60

Dim iMinutes As Integer = iValue \ 60

Dim strDisplay As String

If iSeconds < 10 Then

strDisplay = iMinutes & ":0" & iSeconds

Else

strDisplay = iMinutes & ":" & iSeconds

End If

ledCount.Text = strDisplay

End Sub

Sid.
Apr 22 '06 #3

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

Similar topics

0
2065
by: John | last post by:
I have an web form that I created in VS .NET 2003. On this web form, there are check boxes and radio buttons. Utilizing AutoPostBack=TRUE, when a specific check box is selected, a text box is displayed to the visitor. When it is unchecked, the text box goes away. All that works like I want it to. However, because I am using AutoPostBack, the form reloads and brings focus to the top of the web form. I would like to bring focus to the...
6
4338
by: Charles Banas | last post by:
weird subject - i hope more than just one curious regular will hear me out. :) ok, i've got a bit of a big problem, and i need answers as soon as possible. i know this forum is meant for web developers, but is relevant discussion. i'm not OT here unless someone thinks i'm trolling (which i'm not, obviously). then i'll disappear and never show my face again. :P
3
3048
by: bradwiseathome | last post by:
I focus on controls in a web form like this: <script language="javascript"> var focusControl = null; if (document.getElementById) focusControl = document.getElementById('txtArea1'); else if (document.all) focusControl = document.all; if (focusControl && focusControl.focus) focusControl.focus();
13
7482
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on it, a frontend and a backend. Case 1: If vba code on the frontend updates many rows (360,000) on the backend, a form's timer event (from the frontend) will stop firing until the user gives the form focus. (Note that the update itself always...
2
2065
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? Here is the story. I have this structure:
18
1211
by: Charles May | last post by:
I know I've done this somewhere but I cannot find any example of it in any of my test code. I have a form with a Listbox that is filled by a dataset it fills in various textboxes. When the form first opens, I have to tab to the listbox so that I can scroll down the list. How do I setfocus to the listbox (I know I can change the tab order but I
4
2477
by: easoftware | last post by:
I am using VS .Net 2003 and VB. I have an app with one parent and two Mdi child forms. I need to validate data in the Mdi form. The Form.Validating event works when I try to close a Mdi form, but not when I try to switch form one Mdi form to the other. I tried to add code to MdiForm1's Deactivate event: Private Sub MidForm1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate Dim TempE As...
0
1915
by: jvitti | last post by:
I recently upgraded from Access 2000 to Access 2007 and I am having trouble with moving the focus from 1 form to another. While doing data entry if a similar claim is found the claim view form will open listing the similar claims. The data entry clerk can view 1 of the claims and by doubling clicking on the claim number some info from the claim view will be used to populate fields on the data entry screen. The following code is used...
0
8590
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9140
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
9005
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...
0
8845
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
7693
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
6512
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
4603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3025
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.