473,657 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect when a form opens

Hi All

I have an on-screen keyboard within a POS program I have written in VB.net
2005, for touch screen computers

I have it set to 'always on top' so the user can move the cursor to
different text boxes and type using the on-screen keyboard
The keyboard launches via the mouseclick event for any text box

If another form is launched, with the onscreen keyboard still visible, the
on-screen keyboard cannot be closed as the new form is opened modally and
will not release focus

Is there an event which captures when any form loads so I can close the
on-screen keyboard first?

Any other ideas other than putting code in every forms load event?

Regards
Steve
Oct 29 '07 #1
6 2223
Hi Steve,

Based on my understanding, you have a WinForm application and want to get
notified when any form is going to be shown, so that you could close the
on-screen keyboard first. If I'm off base, please feel free to let me know.

I would say that there may no such an event which captures when any form
loads. A workaround to your question is to detect whether the on-screen
keyboard is visible or not when a new form is going to be shown modally. If
yes, close the on-screen keyboard first and then show this new form.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 29 '07 #2
Heya Steve,

I'm not sure if this will help at all - BUT you can Override the OnLoad
method in your forms to handle additional logic that needs to be done

<code>
Protected Overrides Sub OnLoad(ByVal e As System.EventArg s)
'Call your method to hide the keyboard BEFORE MyBase is called
MyBase.OnLoad(e )
End Sub
</code>

Although depending on how you developed the system you could possibly create
an overload for the form constructors and ensure the on screen keyboard is
closed before continuing. Possibly pass a Boolean to the overload to signify
that the keyboard is still visible and handle the logic from there...

<code>
Public Sub New(ByVal keyboardVisible As Boolean)
InitializeCompo nent()
hideKeyboard(ke yboardVisible)
End Sub

Private Sub hideKeyboard(By Val keyboardVisible As Boolean)
If keyboardVisible Then
'Do your magic :)
End If
End Sub
</code>

HTH
Brendon
"Steve" <ga*****@nospam .nospamwrote in message
news:OG******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi All

I have an on-screen keyboard within a POS program I have written in VB.net
2005, for touch screen computers

I have it set to 'always on top' so the user can move the cursor to
different text boxes and type using the on-screen keyboard
The keyboard launches via the mouseclick event for any text box

If another form is launched, with the onscreen keyboard still visible, the
on-screen keyboard cannot be closed as the new form is opened modally and
will not release focus

Is there an event which captures when any form loads so I can close the
on-screen keyboard first?

Any other ideas other than putting code in every forms load event?

Regards
Steve
Oct 29 '07 #3
Hi Linda

Thanks for the reply

Further to this
Is there a way to have a modeless topmost form (on screen keyboard) still
accept input (or at least fire an event when clicked) when a modal form is
opened with the modeless form already open?

I am looking for a way to put the code, to close the topmost form, in the
topmost form rather than having to put code in every form load event to
check if the topmost form is open then close it, as I have many forms in my
application

If so this would solve my issue

Regards
Steve
"Linda Liu[MSFT]" <v-****@online.mic rosoft.comwrote in message
news:5k******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Steve,

Based on my understanding, you have a WinForm application and want to get
notified when any form is going to be shown, so that you could close the
on-screen keyboard first. If I'm off base, please feel free to let me
know.

I would say that there may no such an event which captures when any form
loads. A workaround to your question is to detect whether the on-screen
keyboard is visible or not when a new form is going to be shown modally.
If
yes, close the on-screen keyboard first and then show this new form.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 29 '07 #4
Hi Linda

Further to this

I tested the on-screen keyboard that comes with windows XP and it is still
active when I open a modal form from another modal form within my program

Maybe it is because it is a seperate application

Would running my onscreen keyboard in a different thread give the same
behaviour, or do I need to to have my onscreen keyboard as a seperate
application?

Regards
Steve
"Linda Liu[MSFT]" <v-****@online.mic rosoft.comwrote in message
news:5k******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Steve,

Based on my understanding, you have a WinForm application and want to get
notified when any form is going to be shown, so that you could close the
on-screen keyboard first. If I'm off base, please feel free to let me
know.

I would say that there may no such an event which captures when any form
loads. A workaround to your question is to detect whether the on-screen
keyboard is visible or not when a new form is going to be shown modally.
If
yes, close the on-screen keyboard first and then show this new form.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 29 '07 #5
Hi Steve,

Thank you for your prompt reply!
>Is there a way to have a modeless topmost form (on screen keyboard) still
accept input (or at least fire an event when clicked) when a modal form is
opened with the modeless form already open?

As you have mentioned, you could show the screen keyboard form in a
seperate thread to get the above behavior. The following is a sample to do
this:
public partial class Form1 : Form
{
delegate void ShowKeyBoardDel egate();
private void Form1_Load(obje ct sender, EventArgs e)
{
ShowKeyBoardDel egate dele = new
ShowKeyBoardDel egate(ShowKeyBo ard);
// With the call to the BeginInvoke method of the delegate, the
ShowKeyBoard method will be execute in a seperate thread within the
application thread pool
dele.BeginInvok e(null, null);
}
private void ShowKeyBoard()
{
Form2 frm = new Form2();
frm.TopMost = true;
Application.Run (frm);
}
}

I don't suggest you to have the onscreen keyboard as a seperate
application, because this involves the intercommunicat e between two
application, which will definitely add complication.
>I am looking for a way to put the code, to close the topmost form, in the
topmost form rather than having to put code in every form load event to
check if the topmost form is open then close it, as I have many forms in my
application

You can create a base form in your application and in its Load event
handler, check if the onscreen keyboard form is open and if yes, close it.
You need to derive all other forms(except the onscreen keyboard form) in
your application from this base form. Thus, when each derived form is
loaded, it will check if the onscreen keyboard form is open and you needn't
add code to every form to check this.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Oct 30 '07 #6
Hi Linda

Thanks for the great reply

Very much appreciated

Regards
Steve

"Linda Liu[MSFT]" <v-****@online.mic rosoft.comwrote in message
news:uP******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Steve,

Thank you for your prompt reply!
>>Is there a way to have a modeless topmost form (on screen keyboard) still
accept input (or at least fire an event when clicked) when a modal form
is
opened with the modeless form already open?

As you have mentioned, you could show the screen keyboard form in a
seperate thread to get the above behavior. The following is a sample to do
this:
public partial class Form1 : Form
{
delegate void ShowKeyBoardDel egate();
private void Form1_Load(obje ct sender, EventArgs e)
{
ShowKeyBoardDel egate dele = new
ShowKeyBoardDel egate(ShowKeyBo ard);
// With the call to the BeginInvoke method of the delegate, the
ShowKeyBoard method will be execute in a seperate thread within the
application thread pool
dele.BeginInvok e(null, null);
}
private void ShowKeyBoard()
{
Form2 frm = new Form2();
frm.TopMost = true;
Application.Run (frm);
}
}

I don't suggest you to have the onscreen keyboard as a seperate
application, because this involves the intercommunicat e between two
application, which will definitely add complication.
>>I am looking for a way to put the code, to close the topmost form, in the
topmost form rather than having to put code in every form load event to
check if the topmost form is open then close it, as I have many forms in
my
application

You can create a base form in your application and in its Load event
handler, check if the onscreen keyboard form is open and if yes, close it.
You need to derive all other forms(except the onscreen keyboard form) in
your application from this base form. Thus, when each derived form is
loaded, it will check if the onscreen keyboard form is open and you
needn't
add code to every form to check this.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Oct 30 '07 #7

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

Similar topics

0
1855
by: KYAH | last post by:
Hi, If any one knows how to detect when the other side of a telephone call opens the line to start talking and to receive the sound that i've recorded to be played when he opens the line Thanks in advance Karim Youssef
6
2661
by: joebob | last post by:
I've got two forms, Form1 and Form2. Form1 opens invisibly when the database opens. From Form1 (or from a regular module or class module accessed by Form1), is there a way to detect when Form2 opens? I'm restricted to only coding in Form1 (or a regular module or class module accessed by Form1). The code can't be in another Form's module, and can't be in the application's startup module fired by the AutoExec macro. That's already being...
12
17044
by: Patrick Dugan | last post by:
I have an vb.net application that is a module that uses a "application.run" in the sub main to start. There is no form involved (just a system tray icon) How can you detect when the application is being closed? It is easy enough if the user selects "exit" from this tray icon but how can you detect if Windows is closing the program down? Normally I would simply do something in the Form.Closing event but without a form how can you...
8
3020
by: BJ | last post by:
Problem: How can I code up a client side process to detect if the network is available? Synopsis: I am writing ASP.NET input forms for a Panasonic Tuff book. The users will be walking around the plant with a wireless connection. There are some pockets of non-connectivity. I've been tasked with disabling the submit button on the form if the network is unavailable. Possible solution: I can instantiate a timed process (VB.NET 2.0
2
10113
by: bobh | last post by:
Hi All, In AccessXP on the main menu screen I give the user the option to open this form in either Edit or Read-Only mode. When the user chooses read-only which I use the following line DoCmd.OpenForm "frmLookupAgencyContactInfo", , , , acFormReadOnly, , strSQL
3
5019
by: lrlebron | last post by:
I am using the following to detect if a popup window is already open. I only want to open a new window if it does not exist or has been closed. <HTML> <HEAD> <script language="JavaScript" type="text/javascript"> <!-- var myPage; function openMyPage() { if (!myPage || myPage.closed){
3
2405
by: Chris | last post by:
Hi, I'm a bit of a vb.net newbie. I'm building a application in VS2005 that will help manage my business. I've got the form working to a extent. What i want to know is the following: 1. Is there a way i can make a instance of the form load as if i was creating a new record to append to the bound dataset? Cheers
21
5489
by: Bob Darlington | last post by:
I have a routine which checks idle time and opens a pop up screen to advise users before shutting them down. The pop up has an option for the user to keep the application open, in which case the timer is reset for another period. The problem occurs if the user is working on another application at the time the pop up is activated, in which case it cannot be seen. Is there any way to shift the focus back to my access app so that they can...
18
9049
by: sebastian | last post by:
Can this be done without client-side scripting? I thought sessions might be the answer but after some testing found that sometimes the old session data remained even after the user left the site and returned. Just had an idea, though. Perhaps I could access the users Referrer header?
0
8310
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,...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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
7330
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
6166
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
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.