Control - Prevent Another Application From Losing Focus

Nov 23, 2011

I'm creating some software to keep my students on task. I've set it up so that I can control certain aspects of their computer from my computer. Problem is, I'm not sure how to control other applications from my application. I mostly just want to prevent it from being minimized. Some students like to switch screens quickly when I walk by. I would just like to make sure that it is always on top until I specify otherwise. I'm using, I'm using the 3.5 .net framework for compatibility reasons.


VS 2008 Prevent St From Losing Focus?

Jun 14, 2009

I have 2 window forms, form1 has a button, which will send a msgbox when I click on, and form2 closes when it's deactivate-event raised. If I have form2 focused, and I click on the button of the form1, form2 will get focus and then close, but no msgbox showed from form1, what should I do to get the msgbox in that case?

View 5 Replies View Related

Prevent A Modeless Form From Losing Its Focus?

Jan 16, 2012

Is is possible to prevent a modeless form from losing its focus?  I would like to force users to click the exit button of an addin form shown modeless before they wander into the main application.  I need to show an user form of an addin modeless, in order to be able to interact with the document of main application.  However, I would like to force them to exit this form before going into the main application. 

View 5 Replies View Related

VS 2010 How To Prevent Form From Losing Focus

Sep 12, 2010

I want to prevent my application from losing focus, untill I close it. (so that I can not click on ANYTHING else, untill I'm done with it. period.)I've tried using Me.Focus() on a timer, but that doesn't do s***...I've also tried countless API's out there, but I seriously can't get any of them to work.. my form simply does NOT want to stay in focus! It's driving me crazy! What the hell am I doing wrong?

View 2 Replies View Related

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 View Related

Prevent Container To Auto-scroll When A Partially-visible Child Control Got Focus?

Dec 17, 2011

A panel with enabled scrollbars has many buttons. If I push the tabulation key, focus navigates between buttons.When a partially visible button has focus, the panel scrolls itself in order to completely show the button.

View 1 Replies View Related

Losing Focus On Other Applications?

Nov 18, 2010

I've written a short application that consists of a form, listviewbox and a timer, the program sits in the taskbar with the form invisible, the timer is set for 40 seconds and basically it queries a database held on an SQL 2000 server, when a certain change happens within the database my form pops up and shows some data in the listview, this happens well, the problem I have is when the check is going on (every 40 seconds) the user loses focus on what ever they're working on. Is there a way I can stop this?

View 2 Replies View Related

New Processes And Losing Focus?

Apr 19, 2009

I need to start multiple processes, with minimized windows - and I don't want whatever the current process is to lose focus.Something like this should be simple enough:


However, whatever application is running will lose focus when this code is executed. I've looked high and low, and there doesn't seem to be any relatively simple way to do this. I had some ideas about capturing whatever application has focus (I don't want to assume my program has focus), then running the above code, and then restoring focus. However, I'm fairly certain this will require win32 API calls, and I'm not sure how to do that.

View 4 Replies View Related

Why Does The Msgbox Keep Losing Focus

Jan 23, 2011


Dim sqlConn As New SqlConnection("server=.SQLEXPRESS;Integrated Security=true; Database=memberlist;")
Dim sqlComm As New SqlCommand("SELECT * FROM memberlist", sqlConn)


when i do this the first msgbox pops up, i click ok, it then loses focus, i think its actually minimizing. I then have to click it in the task bar several times to get it to come back up. from then it will sometimes give each msgbox over and over just fine, sometimes it will minimizes random ones. the first one seems to be a constant.

View 5 Replies View Related

Save On Form Losing Focus?

Nov 30, 2009

I have three forms frmStudent, frmClass and frmMain. I want to add code so that if the user focuses on another form without saving a message box will appear to prompt the user to save. This is necessary because If the user starts entering data on another, related formand assumes that the changes from the first form were saved, then there could be integrity issues.

I have tried formating the deactivate event, but when I hit yes it just deletes the record entered.

Private Sub frmStudent_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Deactivate
If GradebookDataSet.HasChanges Then


View 1 Replies View Related

Show Form Without Losing Focus?

Aug 23, 2010

I've created a small form that acts like the office notifications (fades inout above the notification icon tray)I'm having problems showing this form, I want to display it without the focus being taken from my main application (or any other form), I've managed to get the attached code doing roughly this, (using Me.Activate to take back focus) But this isn't great - focus switches for an instant plus I want to show the form from various areas in my application...

Dim frm2 As New frmNotification()
frm2.TopMost = True

View 1 Replies View Related

DataGridViewCell Background Color Change Without Losing Focus?

Sep 16, 2009

In VB .Net 3.5, is it possible to change the color of a DataGridViewCell (unbound) to a different color and have the cell visibly change before losing focus or leaving the cell? I have a timer that's running that queries with the data present and I'd like for the colors to change immediately instead of after the user leaves the cell.

I've tried DataGridView.Refresh and Me.Refresh and don't get results.

What am I doing wrong? (Below is the code I use to change the background)

''' <summary>
''' Sets or clears the passed cells background to Red
''' </summary>


View 2 Replies View Related

VS 2008 AxDataGrid: Cells Clear Out Upon Losing Focus?

Jan 10, 2011

On a .Net app, I got an AxDataGrid on a form. The DataSource of the grid is a RecordSet,created by parsing a comma-delimited text file.rom the UI, I add a new column with a defined size to the text file and then reload the data grid with a routine that creates a new ResultSet and binds it to the grid. Things are fine and the new column is shown.

View 1 Replies View Related

.net - Prevent Form From Stealing Focus?

Mar 10, 2009

When I run my VB.NET Winforms app I do not want it to steal the focus from the other open apps. FYI, my app is started from the command line but that shouldn't make a difference. I've seen question 577076 but that doesn't seem to work.

View 2 Replies View Related

Prevent A Datagridview Cell From Getting Focus?

Jan 3, 2010

vs 2005 sql 2005 developer/I have a datagridview with 4 columns .I want the user to be able to use the arrow keys to move through the rows and just two of the columns.I want the other two rows to behave like a label that cannot get the focus. Nor be selected.I have been messing arround with the "cell enter" event but the language wont let me set the selected cell from within that routine.

View 4 Replies View Related

Prevent A Datagridview From Loosing Focus?

Jan 11, 2010

I have a datagridview. If the user adds a new row, and then clicks away from the grid. How can i stop them from doing this?

I want them to finish the row add first or cancel it. I want to then update the table adapter in the grid's leave event.

If the row validation fails, i want to display a message and re-focus to the cell in question.

The first problem i am running into is that the focus continues to go to the control that the user clicked on to move away from the grid.

How do i cancel that event?

As an example, if the grid is on a tab page and the user clicks on another tab page, i want to prevent that page from displaying if there is an error on the row that is being added to the grid.

I was hopeing for a cancel option in the lost focus event of the grid.

View 4 Replies View Related

Prevent Automatic Selection On Textbox Focus

Apr 16, 2010

When you use a tab key to select a textbox, all text in it is automatically selected. What's the easiest way to prevent this from happening? (Setting the selection to none in Enter or GotFocus events doesn't work)

View 1 Replies View Related

Prevent Form Focus When Click The Buttons On It?

Oct 20, 2010

I am writing an on screen keyboard in VB.NET for a touchscreen. My problem is; how do I keep my keyboard form from getting focus when someone clicks the buttons on it? I have it on top using Me.TopMost That part is working great but I want to leave the current app have focus, not my keyboard. I'm guessing I need to use Windows API functions to accomplish this, however, I have not found any good examples in VB.NET.

View 2 Replies View Related

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".


View 4 Replies View Related

Prevent Popup Toolbox Form From Stealing Parent's Focus?

Aug 4, 2011

how to prevent a popup toolbox window (Form) from stealing the parent Form's focus?I've been told to override CreateParams and use WS_EX_NOACTIVATE (0x08000000) but that does not seem to work (see the code segment shown below). I'm using Show() and not ShowDialog(). 

Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Dim cp As CreateParams = MyBase.CreateParams


View 1 Replies View Related

C# - WPF: Control Losing Its Binding?

Nov 26, 2010

I have a MenuItem of a context menu of a Grid and its IsEnabled property is bound to MyProperty. It works fine until I actually click on the event handler of the MenuItem, which has no code in it. After I have clicked on the MenuItem the dataBinding no longer works.

I can tell cos' my breakpoint in the getter of MyProperty does not get hit.


View 2 Replies View Related

Losing Control Handles Code

Jan 14, 2011

Just about every day as I build my app and run/test it, I click on a control (button, grid, anything) and nothing happens.I double-click the control in design mode, and it's like clicking on a new control, no code is there.It turns out that the control loses the part of the line of code.[code]This has happened so often that I know I'm not deleting it accidentally.

View 8 Replies View Related

Lost Focus Event, What Control Is Getting Focus?

Mar 21, 2012

I have a textbox on a form that when it loses focus it updates other text boxes on the form. But before it updates the other textboxes I check the input value in the textbox lostfocus event if it is undesired I return focus to the the textbox and alert the the user with a msgbox. However where my problem is, is that when the cancel button is clicked I don't care what the input in the textbox is because the changes are being canceled but if the value is undesired the it keeps returning focus to the textbox instead of canceling the changes. Is there a way to see what control was clicked on before or in the lost focus event? Can't seem to figure it out tried enter and leave events but no luck!

So for example something like this...

Private Sub TextBox1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
If Control that was clicked <> btnCancel then


View 2 Replies View Related

VS 2008 Losing Session In Webbrowser Control?

Mar 8, 2012

i am using Visual Studio 2008 Expres Edition. I use the WebpageManipulation Example VB Code from KLEINMA downloaded from this forum. It uses a Webbrowser Control. What i want to do:


View 1 Replies View Related - Losing <asp:Label> Text Value From ViewState For Dynamically Added Control?

Mar 5, 2012

I am adding controls to a page programatically in the code behind. I add an asp:Label and set it's Text value. I add an asp:TextBox and set it's Text value. Both Text values are returned in the Response and displayed in the browser. All fine so far.

The user performs an action that causes a postback. I re-load the dynamically added asp:Label and asp:TextBox. When the Response is returned to the browser, only the asp:TextBox Text value is displayed. The asp:Label Text value is not. If I inspect the HTML I can see the asp:Label control (rendered as an HTML span tag) but no value.

How can I get the code to automatically re-load the Text value of an asp:Label on each postback? Why is the behaviour different for an asp:Label and an asp:TextBox? I do not want to have to manually re-set the Text value on each postback.

Here is some code similar to what I am doing (placeHolderNameplates is an asp:PlaceHolder control on the aspx page): Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Not Page.IsPostBack Then


View 3 Replies View Related

Custom Control Losing Size Around Edge When Added To Form

Dec 7, 2011

Having some issues with creating a simple control in

I create a control with a single label in, I don't change anything except the colour of the control and the label and also making the label anchor to the edges ( with a small border around the edge)

When i then build it and add this control to a form. Some of the edges are cut off and it isn't anchored the way it was in the control.[url]...

as you can see in the second image the control has lost its white border at the right and bottom.

View 1 Replies View Related

Deployment :: Is There Another Application Can Use To Deploy Project Without Losing Sanity

Mar 3, 2012

Using Visual Studio 2010, Windows 7.Setting up project on one machine, then attempting deployment it on another machine with Windows 7 on it:When it comes to deployment, every time I have one to do, it is like pulling teeth.I am in file system setup, and I have a custom folder created with DefaultLocation set at [CommonAppDataFolder].Supposably you can use the "Common Files Folder" too, but that did not work either.What is happening is, I have three files in this folder, and two of them copy over just fine, when I look at the ProgramData/Tachufind folder, both of those files are in there, but no sign whatsoever of the third file.I have tried deleting and then re-copying the file back in, to no avail.I have tried setting various properties, to see if that will change anything, to no avail. Can't Microsoft make this easier, this is deployment-hell! Is there another application you can use to deploy a project without losing your sanity?

View 4 Replies View Related

Release Configuration Mode - Custom Control Losing Property Settings

Jun 27, 2011

I have a custom control that as a custom property. The property has several preset values to chose from a drop down. The control can be added to a form. The property can be viewed and set in the properties box in the IDE. It all works fine. 

Here's the problem: I can create new versions and recompile the control and/or the application without the properties preset value being lost as long as I do it in Debug mode. However, once I try to recompile in Release mode the custom property values predefined setting is lost. I first thought it was something with going from debug mode to release mode. But it seems to be ANY time I recompile in Release mode the custom property values are lost. Is this a quirk in VS that needs a configuration setting, etc. to get around it?

View 3 Replies View Related

C# - Prevent Design Mode Enabled Child Control From Being Moved Outside Of Its Containing Control?

Jun 30, 2010

I have a UserControl that contains other controls that I would like to be able to rearrange or resize at design time. So I have a custom designer for the UserControl that inherits from System.Windows.Forms.Design.ParentControlDesigner, and I call EnableDesignMode on the child controls from within the designer. That way, at design time, I can drag and drop the child controls to move them, or resize them. But I can also drag and drop the child controls somewhere else on the form that is outside of the original UserControl. Is there a way I can limit the child controls from being moved or resized outside the UserControl?

View 1 Replies View Related

Set Focus On The Keydown Event So After The Button Control, Sets The Focus Into The Keydown?

Dec 15, 2010

Is it possible to set focus on the keydown event so after the button control, sets the focus into the keydown? although says often control can have focus,.Putting a button and a keydown event on a form...

View 2 Replies View Related

Prevent Refresh Of The WebBrowser Control?

Mar 12, 2012

There is PreviewKeyDown but I don't know how to prevent it from passing the keypress to the browser using that method & WebBrowserShortcutsEnabled will disable them but not allow other stuff like Control+C,Control+V and even the delete key in a textbox wont function as well as technically any F keys will not be passed to the flash I have running in the web browser control so the reason for disabling was made moot because the keys still aren't usable in the flash game either because they don't function at all anymore or it has an action already(F5-refresh)How do I disable it without stopping it from being used by the underlying webpage - flash in this example....

Return returns execution to it so it ends up calling keydown like normal, there is no actual keydown event for the webbrowser control or id use that....I cant block navigation because a refresh appears to not call any of the navigation stuff....End stops execution of the whole program it seems, not just stopping that part of code in its tracks...Stop just pauses the program in the debugger....Exit has the same result as return does....

Is there no way to either use PreviewKeyDown to not return execution to the caller....or maybe some kind of await procedure(visual Studio 2011 & its await procedures/async procedures) or something which will never finish... them using it a lot(the F5 key) wont use a lot of cpu while it waits for something that would never happen....Or just any other method which could make this work how I need it....

View 7 Replies View Related

Prevent A Keypress In Another Application?

Mar 17, 2011

We have 2 apps that we display at once for data entry. 1 taking up the left side of the screen, and 1 taking up the right side.

1 of those apps is the data entry application. The other app is for viewing scanned info. But they can't talk to each other directly.

So I'm creating a tool that runs in the background to intercept certain keys.

I want to be able to capture keys such of Ctrl + Home, Ctrl + Page Up, etc from the data entry application, and send it to the scanned image to rotate it or zoom, etc.

I believe I can do most of it, except 1 part.

Right now if I did Ctrl + PageUp, it will send the key press to both apps. How do I prevent a keypress from the originating application?

View 4 Replies View Related

Prevent From Collapsing The Application?

Jan 31, 2011

am importing the Excel sheet data into Textbox controls based Key Column(WONumber) from application folder where all Excel files resided.if i typed wrong WONumber(Un available file in Excefilesl folder) and clck on load application getting collpased, i wanted to prevent this and just through a message "WONumber is not presente in the Excelfile folder"

Syntax error (missing operator) in query expression 'Wono='.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more in


View 3 Replies View Related

Control Focus / Control Select

Jun 1, 2010

I have read this many times. Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms. What exactly is the difference? Subnet Calculator / Planner Serial Port

View 12 Replies View Related

Prevent Windows Application (.Net) Termination?

Apr 10, 2012

I have the need to either prevent, or restrict, the termination of a VB.Net application. I have no problem with Admin killing the application, but not a user. I've been unable to come up with a solution for this. Is there maybe even a way to set local policy to prevent termination by non-admin?

View 2 Replies View Related

Set A Focus For A Control In VB?

Sep 11, 2009

how to set a focus for a control in VB

View 3 Replies View Related

Set Focus On Control?

Jun 1, 2011

I tried to used this but no luck[code]...

if the use click the radio button i want to focus on Hyperlink4

View 2 Replies View Related

Prevent WebBrowser Control Open External Browser

Apr 14, 2012

I have a windows form that have 5 webbrowser control. I also have serveral links of URLs and each webbrowser will open them. My problem is that after all links already opened, when I close my windows forms, sometimes my application suddenly open my default browser automatically and open url that on my URL list. I already tried to make all webbrowser to navigate to "about:blank"to make sure there are not loading any webpage before I close my application but the problem is still occur. This has given me a headache since this problem is not always occur when I close my application.

View 6 Replies View Related

VS 2008 Prevent Re-size Of A Control At Design Time?

Sep 26, 2011

How can i do this ... by the propper way i mean so that the grippers don't even display - like they do with an auto-sized label, or a non-multiline textbox.

View 4 Replies View Related

Prevent Dual Login Of Users In Web Application?

Feb 7, 2010

how do I prevent my users for more than one simultaneous login per account. I am using Vb.Net SQL.

View 2 Replies View Related

Prevent Original VB Window Quitting The Application?

Sep 17, 2010

I'm still learning Visual Basic and I'm creating a web browser with basic tab and new window support. My problem is that if new windows are created if the original form window is closed, both windows are closed and the program is quitted. This is to be expected but like any browser the program quits based on the last remaining window open. How would I do this in Visual Basic?

View 4 Replies View Related

VS 2008 - Prevent Application From Taking Screenshot?

Aug 26, 2010

Any way to prevent my application from taking screen shot. I am using this method
If Clipboard.ContainsImage = True Then Clipboard.Clear()
If this is correct? And also what about screen capture application they take the screen shot without using clipboard what is logic behind it and if there is any way to resolve it?

View 13 Replies View Related

Focus To A Control In Groupbox?

Jun 19, 2009

from my main form i'm giving focus to a control dynamically to calling form for example i have 3 child form, child1, child2, child3 form main form before i call the form i give the focus to a control which is set on some condition


and when i call child1.controls(cntrlname).focus() it throws the error. any idea how i can give focus using above code to one of my control in groupbox.

View 2 Replies View Related

Set Focus To A Specific Tab On Tab Control?

May 24, 2010

I need to know how to set the focus to a specific tab on a multi-tab tab control.[code]each followed by a .Refresh, but the tab control stays on the same tab.  Do I have to cycle thru the index to get back to the base tab on the form, or what?

View 1 Replies View Related

Set Focus To Control Using Shortcut Key?

Feb 2, 2011

I have to set focus on combobox control when F2 key is pressed on the key board.

View 2 Replies View Related