Forms :: Base Window Events Are Triggered When Focus Is On Another Form On Its Top?

Apr 3, 2009

I am migrating my code from vb.net 1.1 framework to vb.net 3.5In my windows application, the base window has some buttons and events are written for the same.I have shortcuts defined for these buttons also, for example: ctrl+d, DEL (keyboard) etc.Now i open a property Grid form on top of my base window for a selected object.Even when the focus is on this property grid, i am noticing that my base window events are firing on pressing those shortcuts.

example:I select some text in my property grid and hit delete button from keyboard. The delete event that i have written for the selected object gets fired and the text is not deleting.I fail to understand why is it happening. It wasnt behaving like this in .net 1.1.In .net 1.1 it would delete the text and only when the focus is back on the base window, hitting Delete would call the event.How do i control such a behavior? Is there some property that i need to set for property grid in .net 3.5 to prevent base window events from firing till the time focus is on property grid form?

View 1 Replies


ADVERTISEMENT

Forms :: Use The Focus Events Of The Combobox's To Determine?

Jan 7, 2010

I have two questions for anyone who can throw some idea's my way question 1:I am currently working on a control with three combo box's. This control will be nested on a form, and I want the on-board timer to track how long each control is active. I am trying to use the focus events of the combobox's to determine if the control is active so the program will know when the timer should be started and stopped. My problem is, for example, when the user causes the text property of the combo boxes to change, the folowing code runs:

[Code]...

As you can see, there are points in this sub-routine that can cause the focus to shift, as well as fire the text changed event. While this all happens faster than is really noticable, I would like to eliminate the extra cycles if at all possible. As I mentioned in question one, I am adding this control to a form, to be more clear I am adding multiple instances of this control to a single form, and I am trying to use the focus events to determine which of the controls within the form are active; however, when the form itself is no longer the active application, whether it is minimized, behind another application or otherwise, all of the timers stop. I want whichever control was active at the time that the form was deactivated, to continue as if nothing changed.

View 2 Replies

Forms :: Form Losing Focus - Keeps Loosing Focus ?

Nov 26, 2009

I have two forms in an application. One is he background and then I show another keypad form called with the show() method (not showDialog) because I need to perform some validations on btn click.

The kepad has 10 buttons and an Enter Button. The problem is that the form keeps loosing focus (I checked this with a messagebox which keeps poping up once for focus=true and again for focus=false, it continuously keeps losing and gaining focus) so it does not process any keypress events untill i click somewhere on the form. I tried using me.focus() in form load event but to no avail. The forms TopMost property is also set to true.

View 5 Replies

Forms :: Unable To Set Cursor Focus In Sub Window?

Dec 20, 2009

currently I have a Customer Master screen. Inside the screen, I have a button which call the Customer sub window.

When I call the sub window, I want the set the cursor at Textbox1.

The problem is, when I call the window for 1st time, the cursor stops at Textbox1. When I call the window for 2nd or 3rd time, the cursor stops at other textbox or buttons inside the sub window.

Seems like Textbox1.focus is not working.

'***************Calling sub window from main screen**********
Private Sub BTN_CUSTOMER_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTN_SEARCH.Click

[Code]....

View 1 Replies

Determine Which Of The Two Events Triggered The Sub-routine

Mar 23, 2012

I have a combobox sub-routine that is triggered by either a "SelectedIndexChanged" or "Leave" event How can I determine which of the two events triggered the sub-routine

[Code]...

View 7 Replies

Detecting Mouse Wheel Events When Form Does Not Have Focus In Visual Basic 2010

Aug 11, 2011

I want to make an auto log off feature, I want to detect if there is any user input, and if there isn't the user will be automatically logged off. So I want to know how to detect mouse wheel events when the form doesn't have focus.

View 1 Replies

Disable The Focus To Parent Window(Form) While The Msgbox Is Opened?

Dec 13, 2008

I am having form called Test1 which contains button( Button1). When I press the button the message box is getting displaying,but at the same time I am accessing the Form Test1. It should not be the case, because before closing the message box the control should not allow to focus the Test1. But in my case the control is allowing to focus the Test1(form) before closing the message box.

Sample code.

If myReader.Read() Then
MsgBox("Matched record exist.", MsgBoxStyle.Information, "Data Tool")
Else

[Code].....

View 4 Replies

Windows Form Closing Automatically When Parent Window Gets Focus?

Jan 24, 2012

VB Windows form Application.. I am developing an application of which part of the program is around configuration settings allowing the user to enter configuration items. When the menubar item for configuration menu is clicked on the main form the menu opens.This is fine but the mainform should not become active again until the configuration menu has closed. This does not happen right now and the mainform simply comes to the foreground and the configuration form goes to the background... I realize that coding an event on the Child form to handle this would not work because the child window loses control and the main form gains control.. I thought of coding a function as follows on the main form but it does not seem logical because i would have to add to it for everyform and do checking to make sure the child is actually open before trying to close it..

Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
MailSettingsWindow.Close()
RentalSettingsWindow.Close()

[code]....

I did away with the above sub routine and used the below code as per the recomendation of using showdialog which works just as i was looking for.

Private Sub MailingAndEmailSettingsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MailingAndEmailSettingsToolStripMenuItem.Click
Dim MailConfig As New MailSettingsWindow()
MailSettingsWindow.Showdialog()
End Sub

View 1 Replies

Forms :: Put DataGridView DataSource Into A DataTable From Base Form?

Jul 15, 2010

I have a base form and I am trying to get the DataSource of the ActiveControl if the control is a datagridview.What I have so far is:

Dim curControl As Control = Me.ActiveControl
Dim ControlType As String = curControl.GetType.ToString()
If ControlType = "System.Windows.Forms.DataGridView" Then

[code].....

View 4 Replies

Window Focus - Right Click On The NotifyIcon, Excel Gains Focus?

Mar 10, 2009

Here is what I've done:1) Created an Excel COM add-in for Excel 20032) Added a NotifyIcon to the Windows taskbar notification area (aka system tray) during ThisAddIn_Startup3) Added a ContextMenuStrip with a ToolStripButton to the NotifyIconWhy is it when I right click on the NotifyIcon, Excel gains focus? If after clicking on the NotifyIcon to display the ContextMenuStrip I choose not select an option on the ContextMenuStrip and instead click back on the Excel window, I get a weird flashing cell in Excel.I've created a video of the problem to help you see what I [url] anyone know how to prevent this? Ideally, I'd like to be able to click back on Excel and only have the ContextMenuStrip close and Excel regain focus.

View 1 Replies

Forms :: Form Has Focus Over Others With Project?

Feb 4, 2009

is it possible to have the same effect as a dialogue box, with form focus? eg, when using the open dialogue box, if you try to focus on another form within the app, it doesn't' let you and starts flashing. But when you switch to another app, it doesn't interfere.

View 2 Replies

Forms Within Form Got/change Focus?

Jan 23, 2011

I have 1 form with about 5 other forms added into it. How can I check which form the user is currently on. I have tried using gotfocus for the 5 forms within, but it doesn't work. is there another way of seeing when focus has changed within the form?

View 3 Replies

Base Form And Inherited Other Forms From It - Don't See Those Changes Take Effect In My Inherited Forms?

Jun 24, 2010

I have a base form and I inherit other forms from it. However, if i go back and change say the size of the base form, I don't see those changes take effect in my inherited forms. Does anyone know why that is? Is there a solution to this issue?So as far as design is goes, what exactly gets inherited by other forms?

View 9 Replies

Forms :: Focus() Method Fails With Second Show Form?

Feb 7, 2010

I have a simple login field, which works fine with the exception of one quirk. The form is set up with the tab order to go to the UserID first and the Password text box second. This works fine when the form is used the first time, but when the form is used the second time the focus in placed in the Password field. If the form is used a third time, focus is moved the OK button, that is each time moves to the next tab order. I even tried to set the focus in the Load event as in Me.txtUserID.Focus(), but this doesn't change the behavior. Again, I should note that I close the form and not hide the form.

View 3 Replies

.net - Events In Base Classes?

May 19, 2009

i have a base class which declares the event StatusTextChanged. My child class, of course cannot directly raise this event.

[Code]...

View 5 Replies

Forms :: Restore A Windows Form Which Is Minimized And Has Lost Focus?

Dec 2, 2009

I have created an app which has a timer control which, when activated and meets a certain criteria, launches a second form with an alert for the user to review and action. this works just fine. Except.... when the main app is minimised and has lost focus, instead of launching the second form to a normal windows state it opens and sits in a minimized state itself and just flashes. How can I get the the second form to restore to a normal windows state?I have tried form2.focus and tried the windowsstate=normal etc but I'm still barking up the wrong tree.

View 2 Replies

Implementing Events In A Base Class?

Nov 15, 2010

Consider the following objects:

Public MustInherit Class FileRepository
Public MustOverride Sub SaveStringToFile(ByVal FileText As String, ByVal FilePath As String)
Public Event FileSaved(ByRef sender As Object, ByVal EventArgs As EventArgs)

[code]....

I want my base class to raise the FileSaved event in it's implentation of SaveStringToFile once it's saved the file. However in VB.NET you can't have a derived class raise a base classes event. I suppose I can treat XMLFileRepository_FileSaved as a standard function call and have my SaveStringToFile implementation call it directly?

View 1 Replies

Windows Forms: Unable To Click To Focus A MaskedTextBox In A Non TopLevel Form

May 20, 2010

I've got a Child form being shown with it's TopLevel property set to False and I am unable to click a MaskedTextBox control that it contains (in order to bring focus to it). I can bring focus to it by using TAB on the keyboard though.

The child form contains other regular TextBox controls and these I can click to focus with no problems, although they also exhibit some odd behavior: for example if I've got a value in the Textbox and I try to drag-click from the end of the string to the beginning, nothing happens. In fact I can't use my mouse to move the cursor inside the TextBox's text at all (although they keyboard arrow keys work).I'm not too worried about the odd TextBox behavior, but why can't I activate my MaskedTextBox by clicking on it?

Below is the code that shows the form:

Dim newReportForm As New Form
Dim formName As String
Dim FullTypeName As String
Dim FormInstanceType As Type

[code].....

View 3 Replies

Forms :: Changing The Backcolor Of A Control When It Has Focus And Lost Focus?

Feb 16, 2011

Is there a more efficient/easier way changing the backcolor of a control when it has focus and lost focus? Let's say I've got 10 text boxes. Right now I would have 20 different events...10 for Enter event and 10 for Leave event. Of course, entering would change the back color to "green" and leaving would change it back to "white".

[Code]....

View 4 Replies

Forms :: Keypress Event Is Not Triggered When Push A Key

Mar 23, 2009

I have created the following piece of code to try and see if the user pushes the 'f1' key, and if they do.

[Code]...

I am not sure if this code works yet because the keypressed event is not triggered when I push a key. Could someone tell me how I can change my code so that it will test what key is pressed, no matter what control on the form has focus?

View 7 Replies

Forms :: Power Mode Change Not Getting Triggered

Mar 4, 2009

I have an application that detects a power change (to standby or hibernate).
AddHandler SystemEvents.PowerModeChanged, AddressOf PowerChangeSub
When I hit the standby key on my keyboard, the power change is detected and all actions are done properly. However, when I enter the standby mode by using: Application.SetSuspendState(PowerState.Suspend, True, False)
The computer goes to stand by but the event of powermodechanged is NOT triggered.

View 2 Replies

VS 2008 : Removing Events In Base Class?

Nov 8, 2009

suppose I have the following hirarchy:

Public Class PrimalClass
Public Event SomeEvent()
End Class
Public Class BaseClass

[code]....

this code compiles and runs.what I want to do, is remove the event SomeEvent in BaseClass so that DerivedClass won't be able to register a handler to it.

View 1 Replies

Forms :: "Counter" On Form Quits Counting When Form Loses Focus?

Mar 15, 2009

Most of my experience in Visual Basic programming is in VBA. I'm currently trying to build a VB.NET Windows application that basically consists of a form that has one button and one label. When the button is clicked, the label should serve as a "counter" that counts from 0 to infinity until the user closes the window with the "x" button. I do this by putting a loop with a sleep statement in the onclick sub. The loop iterates the integer that is displayed in the label and does a "Me.Refresh".The problem is when the window loses focus. When it loses focus (when I click off of it), the counter stops. Even when I click back on it, the counter doesn't resume.

View 19 Replies

Forms :: Leave Not Being Triggered On Buttonclick (cursor Is Not Moved)

Oct 5, 2010

I am having a problem where I am on a text box and try to click a button that will bring up some reports. Since my cursor is still on the text box it doesn't go through the "Leave" and so what I entered into the text box is not saved (this happens in "Leave"). I have read previously not to use "Lost Focus" because it causes problems when you leave the form it triggers the "Lost Focus" on on the fields and just in general to use "Leave" rather than "Lost Focus". Is there a way to force my way through the "Leave"? I also don't know which field my cursor could be on (there are probably 20 text box or combo box fields on this form.

View 2 Replies

Error - Base Class 'System.Windows.Forms.Panel' Specified For Class 'MenuButton' Cannot Be Different From The Base Class 'System.Windows.Forms.UserControl'

Mar 12, 2010

When I do this

Public Class cInherits : Inherits Panel

I get this: Base class 'System.Windows.Forms.Panel' specified for class 'MenuButton' cannot be different from the base class 'System.Windows.Forms.UserControl' of one of its other partial types.

How do I inherit?

View 4 Replies

Forms :: Set The Form As The Active Window?

Mar 4, 2011

I was wondering if there's a method to set the form as the active window (not topmost obviously), if it's currently not the active window (meaning another window is currently the active one). By active I mean "selected".

View 1 Replies

VS 2010 Usercontrol Focus And Key Events?

Jan 15, 2012

A form's key events will fire when you press a key. Place a control on that form and it won't happen any more because that control has focus. There are exceptions to this however as you will see if you place just a h or v scrollbar on the form. The key event will fire because the scrollbars can't receive focus as is demonstrated by the following

Private Sub ScrollBar1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles VScrollBar1.GotFocus
Debug.Print("Scroll GF")
End Sub

[code]....

So I've made my own special scrollbar usercontrol and i can't figure out how to have it leave the key events alone. I'm pretty sure that the problem is that my usercontrol can receive focus at the moment.

I found that the way of doing this is "SetStyle(Windows.Forms.ControlStyles.Selectable, False)". I put that in the new event of my usercontrol and now it looks like this:

Public Sub New()
' This call is required by the designer.
InitializeComponent()

View 4 Replies

Error - Handles Clause Requires A With Events Variable Defined In The Containing Type Or One Of Its Base Types

Dec 8, 2011

I am auto generating data grid and I am using check box in Data grid View,Now i am invoking check box state changed event but it produces the following error Handles clause requires a With Events variable defined in the containing type or one of its base types.

Here the code

Private Sub PRNT_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles PRNT.CheckedChanged
Some Stuff.
End Sub

View 2 Replies

Forms :: Streaming Button Click To Form Window

Nov 25, 2009

vb.net experts, I am new to vb.net but I have some programming background and some experience. What I want to do is this. As of right now I have a webpage with buttons on it and each button once clicked runs a script in DOS and a the DOS command windows appear.

I would like to make a vb.net form with buttons on it that each button when clicked executes the same program. However the kicker is I want the DOS output to be displayed within the form along with a scrolling bar to the right of the window so a person can scroll thru the outputted DOS window. Does that make sense?

[Code]...

View 2 Replies

VB 2010 - Express Forms - Load Next Form In Same Window

Feb 10, 2011

I have a very large program I would like to write but think starting with a smaller test program would be a good idea. What I want to know is: I have a base Form from which a user clicks a button to answer a question (Answer A, B, C, or D) which if the answer is correct will pop up a "Correct! answer response in a separate window. This is ok for now, however, when the "proceed to next question" button is clicked, I would like the next question to appear in the original base form window.

Right now it pops up in a separate window and I'd rather not have 20 windows open at the end of the quiz. How do I load the next form in the same window!? Obviously it's possible and could be something I'm completely overlooking, and I've also read that I could replace all data with the next Form. I have searched "Visual Basic load form in same window" and came up with results, but none of what I'm looking for.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved