Activate() Not Working In Deactivate Event?

Jul 23, 2010

We have a VB 2 VB.Net migration MDI application , we have a messagebox in Deactivate event ,once you click Ok for Message Box ,the focus must be set on to the Child Form which is active.



.Net Form Activate/Deactivate Event Firing Issue After Removing A TabPage From TabControl?

Nov 28, 2011

I've recently run into an unexplainable issue regarding a windows form application I am working on.  I've managed to isolate the issue to a single line of code whereby a single TabPage is removed from a TabControl, leaving no tabs left in the TabControl's collection.  What happens next is a bit mystifying: my application proceeds to enter a state in which the main form's Activate event is fired subsequently followed by its Deactivate event.  As a result, no matter where I click on the form, the application will activate for a split-second then immediately deactivate itself, thereby causing me to be unable to interact with any other GUI controls on the form.  I thought maybe another thread is trying to interact with the deleted tab object, but the tab is created and destroyed on the same main gui thread. Does anyone have any insight that may point me in at least a new direction?  Stepping through the debugger to the point in code where the tab is removed does not cause any exception to get thrown, so at first glance there doesn't appear to be any coding issues going on (although I would not be surprised that is actually the case!).

View 3 Replies View Related

C# - Manually Activate/Deactivate SnapLines For Custom Controls?

Apr 21, 2011

I am already overriding the SnapLines property in my ControlDesigner-derived class to manually forward out various snaplines from the child controls of my control -- the text baseline (pink) snap from the labels and comboboxes; the text inset snap from the labels; the top, bottom, left and right snaplines from the comboboxes. Those snaplines activate when the control itself is moved around on the form and when other controls are moved around it.

What I need is the ability to tell the designer to activate the snaplines and then deactivate them while I'm doing an internal move or resize of the underlying controls.My comboboxes are resizable through overrides of OnMouseDragBegin, OnMouseDragMove, and OnMouseDragEnd in my control designer. The magic bullet I'm looking for is something I can call in Begin to tell the designer to show the snaplines and something in End to tell it to stop.

Allowing people to resize and move the internal controls at design time is kind of useless if they don't show snaplines for each other or for external controls.As with stuff like this, it's incredibly hard to search for. I've found one post on a forum where someone asked this exact question that had (of course) no responses. That's about it.

View 1 Replies View Related

Activate Form On MouseEnter Event Not Working

May 25, 2010

I'm trying to make my application become the active window if it currently isn't as soon as the mouse enters the main form of the application (so there is no need to click the title bar of form itself to make the window the currently active one if it's not).

It only sorta/kinda work .... I have to enter the form with the mouse 3-4-5-6-maybe 7 times ... then the window finally becomes the active one.

I know the MouseEnter event is firing each time the mouse enters the app, but the main window isn't becoming active most of the time.

Private Sub frmMain_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
rtbStatus.AppendText("Just got a frmMain.MouseEnter event" & vbCrLf)


View 10 Replies View Related

Registry Permission - Activate / Deactivate The Optical Reader At Startup

Feb 29, 2012

I'm quite new to and I was trying to develope something that can activate/deactivate the Optical reader at startup, so I wrote:


but obviously it's not that simple, I read I need registry permission not to have access denied to the specified key, I imported the namespace and I tried some constructors but without any results...anyone can point me to the right procedure?

View 2 Replies View Related

C# - Difference Between Load Event,Activate Event And Enter Event In The Form?

Mar 30, 2009

I am using VB.NET for Windows applications. What is the difference between Load event,Activate event and Enter event in the Form and in which order the above event is executed.

View 2 Replies View Related

Form Deactivate Keydown Event?

Jun 18, 2011

In my program I've used a text box and KeyPreview is True.When press the Enter-key i hope go to next row but called the default key?

View 2 Replies View Related

How To Activate Event From Somewhere Else

Apr 14, 2011

I am creating a web browser in VB 2010. I have a search box, and I want to make it so that when I press enter in the text box, it searches. [code] The problem with this is that when I press enter, there is this annoying "beep". I don't know where this comes from. The only thing I can think of doing is making the event activate the search button, but I don't know how to do that either. How can I fix this?

View 1 Replies View Related

MDI - Form Activate Event Not Firing

Jul 22, 2011

I am using VB.Net for my Windows application. I will open two child form from MDI. Both forms will open. Now if I will go from form1 to form2 then Activate event for form2 will not fire.

View 1 Replies View Related

Create A Timer That Will Activate A Tick Event?

Jul 11, 2011

I am attempting to create a timer that will activate a tick event every 1 second until stopped by an "If" statement.  The tick event should then drive a clock measuring time in units of hours, minutes and seconds.  The if statements handle the time readout, timer stop and activate another form after a set number of hours have elapsed.  I have tried several different methods and while my application is running, it does not add increments to the integers representing the time units, refresh the displayed time units, or perform any of the timer related functions. I assume the cause is that I just don't know as much as I think I do (which isn't much)

Here is the applicable code:

Imports Microsoft.VisualBasic.ApplicationServices
Imports System.IO
Public Class SessionManager


View 14 Replies View Related

Last Activate Control - Event Leave Calls Another Sub?

Nov 30, 2010

MSDN brings nothing up, so here was my attempt at a work around.


Because event leave calls another sub i need the last active control. I have the textbox name txtTime{0} but obviously string is not a control.

So Two questions:

1) can a string value be attached to an existing control if i know it's name? Dim attControl as Control = newTime

2) All this could be avoided in event leave if i could get the left controls name. I have tried sender. tostring etc but nothing returns the textboxs name

View 6 Replies View Related

Forms :: Set Listbox Checked On Load - Activate - Shown Event

May 17, 2009

I've been having a problem setting certain items in a listbox as checked when the form is loaded. I have tried putting the code in the form_activate, form_load, and form_shown events and each still crashes when it encounters:


View 12 Replies View Related

Does Pressing "Enter" Activate The LostFocus Event Of A Textbox

Jun 28, 2009

how to capture the text that a user enters in a textbox when they press the enter key? I thought there was an event that handles this but I can't quite seem to get anything to work.

View 3 Replies View Related

Use The "NodeMouseClick" Event To Activate Sub Function?

Mar 4, 2007

I use the "NodeMouseClick" event to activate my sub function when I select a single node. But the event occurs also when I click on the "plus" simbol NEAR the node, to open it.Is it possible to activate the event only when I click on a node and not when I open it?I hope to have well explained my problem.

View 4 Replies View Related

Deactivate Fires On Me.Show?

Jan 25, 2010

I am trying to create a winform that will allow me to close when the form either loses focus or deavtivate. When I do Me.Show, it will call the deactivate? Is that right or is weird? The way took it was it fires when it either looses focus or is no longer the active form. 

Also it seem like I have to click the form in order for it to work right. I tried Me.focus and that does work the way I expected.

View 2 Replies View Related

Deactivate Sorting In DataGridView?

Jul 8, 2010

How do i deactivate sorting in my dgv after a certain button is clicked?

View 1 Replies View Related

Deactivate Values In A Combo Box?

Aug 10, 2009

I am working with and have a form with a combo Box. On load the form is loaded with one of the following details depending on what is stored in the database; Cancelled, Processed and Failed.


Then I have an update button and when the user drops down the list he/she can select between Cancelled/Processed/Failed. I want to be able to grey out or disable Processed and Failed, so that when the user updates the field he/she can ONLY update with the Cancelled option ONLY.

View 3 Replies View Related

Deactivate The ContextMenuStrip When Right Click Mouse?

Mar 5, 2009

How do you deactivate the ContextMenuStrip when you right click your mouse. Because I have a checkbox that the ContextMenuStrip will not display if it is not check.. If it is check, the ContextMenuStrip will be activate again.

View 1 Replies View Related

Deactivate The X Button That Close The Application?

Dec 29, 2009

how to deactivate the x button that close the application?i have vb 2008 standard edition

View 17 Replies View Related

Form Activated And Deactivate Events

Apr 3, 2011

This is a non-MDI windows application. I have a home form containing a panel named Panel1 and two buttons btnForm1 and btnForm2. Clicking btnForm1 and btnForm2 opens up Form1 and Form2 respectively in Panel1. Before a form is opened in Panel1, all opened forms in Panel1 are cleared. The code follows:[code...]

In which events should the above lines be written? In MDI apps this could have been accomplished by including them in Form_Activated and Form_Deactivate events respectively.

But here neither Activated nor Deactivate events fire when you open forms in frmHome.Panel1. Instead of Activated and Deactivate you can use Form_Load an Form_FormClosed events but they will only merge/unmerge menus if existing forms are closed before opening a new form in the panel.

But as I sometimes need forms to be opened and closed keeping existing forms opened, using these events won't fulfill the task. Even the GotFocus and LostFocus events won't work. So I want Activated and Deactivate events to be fired or some other means by which the menus and toolstrips can be merged/unmerged when the form gains/looses focus respectively.

View 1 Replies View Related

Deactivate A Combo Box Once User Has Selected An Option?

Jan 20, 2009

Is it possible to deactivate a combo box once a user has selected an option?

View 1 Replies View Related

KeyDown Event Not Working?

May 11, 2011

I have checked my code countless times, tried other computers, and yet the keydown event will not work.

My code:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyRight Then
imgPerson.Left = imgPerson.Left + 500
End If
End Sub

That's all there is because I was just testing it out. imgPerson does exist, so that's not a problem.

View 3 Replies View Related

KeyPress Event Not Working?

Feb 15, 2012

I just want to ask why my KeyPress event is apparently not working. What I want is that when I press the letter m, the selectedindex property of my listboxes would change. Here is the code;

Select Case Asc(e.KeyChar)
Case 13
tray.ListBox1.SelectedIndex = tray.ListBox1.SelectedIndex + 1


I also want to know what the "e.handled = true" is statement for. I set the KeyPreview property of my form to false and true but it's not working as well. the KeyPress event should be triggered regardless of the control within the form that is in focus.

View 2 Replies View Related

ASP.NET: Simple Event Handling Not Working?

Sep 13, 2009

I have an object Order with a simple event, Public Event ErrorOccurred(ByVal msg As String)that I raise in the constructor like so when an order cannot be found (along w/setting a boolean error flag:

RaiseEvent ErrorOccurred("This order does not exist in the database.")
[Error] = True

I have a webform subscribed to the order's ErrorOccurred event:

Public WithEvents o As New Order

and I have an error handler method on the form:

Private Sub OnErrorOccurred(ByVal msg As String) Handles o.ErrorOccurred
litMsg.Text = "<p class=""error-confirm"">" & msg & "</p>"
End Sub

When a textbox is changed, it autoposts back to the page and employs the following logic:

Private Sub txtOrderID_TextChanged(ByVal sender As Object,_
ByVal e As System.EventArgs) Handles txtOrderID.TextChanged
If IsNumeric(txtOrderID.Text) Then


When there is an error (when the Else logic is run), everything performs as expected except the event does not fire. However, since the Error flag is set to true, it means the event MUST have fired, since that line executes AFTER the RaiseEvent line. I've tried everything I can think of, but I cannot figure out what could be wrong. I have events strewn everywhere in my project and they all work well using virtually the same structure.

View 1 Replies View Related

Contextmenu Items Event Not Working?

Nov 11, 2009

I have a form with contextmenu where you can get the menu items on shockwave. I uses the menu items event to get the method of working when clicking them on shockwave by using right-mouse button. When I debug the project and when I clicked on testmenu item event, nothing have happens.

Public Class Form1
Private Sub testmenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles testmenu.Click
MessageBox.Show("this is the test!")
End Sub
End Class

why it doesn't do anything when I click on testmenu item event??

View 8 Replies View Related

Event Handling - Got It Working In C# But Can't Get It To Work In VB?

Nov 16, 2009

I need to create event handler for Outlook event 'item send'. This is to capture the event before email get actually sent. I could generate this event handler in C# within seconds but having problem to do it in VB. Any translation online

C# code:
private void Form1_Load(object sender, EventArgs e)


View 2 Replies View Related

GridView Row Command Event Not Working

Dec 2, 2010

I am having problems trying to get a rowcommand event to fire in a gridview. The code is below.
<asp:GridView ID="GridViewProducts" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
CellPadding="5" CellSpacing="1" DataKeyNames="Pkey"
DataSourceID="SqlDataSourceProducts" ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCCCC" />
<PagerSettings PageButtonCount="20" />
[Code] .....

View 3 Replies View Related

VS 2010 KeyDown Event Not Working?

Feb 20, 2012

I am using the keydown event so that when i press the right arrow the image changes but when i run it nothing happens when i press the arrow key.I have enabled the keypreview Properties?

Private Sub Level1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If tmrWalk.Enabled = True Then
If e.KeyCode = Windows.Forms.Keys.Right Then


View 1 Replies View Related

VS 2010 Load Event Not Working After 2nd Try?

Jun 4, 2011

im having a problem i have a startup form now when it load its check the date and check the date that comes from the database now i got i want after the first try now when i try to log out (after log out click the startup form show) and the code does not execute in the startup_load event i use me.hide to close my startup form after login.. is this the problem thats why after 2nd try it does not execute my startup_load event how can i resolve that i use me.dispose but it close all my program..

View 4 Replies View Related

AddHandler Not Working - Raise The Event In Form

Aug 17, 2010

I'm instantiating an instance of FormQuoteCard from formQuoteList, formQuoteCard has an event and I'm adding an event handler to form1, but when i raise the event in form2, nothing happens:


View 6 Replies View Related - ImageButton In Gridview OnClick Event Not Working?

Nov 19, 2011

I've spent quite a while searching this problem, there are some other similar threads online but none have helped me fix it.I have a GridView with an ImageButton within it, the imagebutton has an OnClick function but that event is never reached when it is clicked, below is my gridview:


View 1 Replies View Related

Button Click Event Not Working Properly?

May 23, 2011

In my windows app i have a button which is only visible when a user selects a certain value on a DropDownList. For some reason the button does not work when i click on itI've enabled the button on page load and it works, however when i choose the value on the Dropdownlist the button does not work.

Protected Sub DropDownList4_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DropDownList4.SelectedIndexChanged
If DropDownList4.SelectedValue = "Yes" Then


View 2 Replies View Related

IDE :: Application Stopped Working After Shutdown Event

Feb 16, 2012

Visual Studio 2008, VB.NET, .NET Framework 3.5. Development Machine Vista Business. Problem occurs in Vista, Windows 7. It does not occur on XP. Others involved: Bennet-Tec Tlist tree control, Farpoint Spread for Winforms 5 spreadsheet control, ADO.NET with Access Database. Message issued:


View 4 Replies View Related

Webbrowser Document Completed Event But Still Not Working In Vb8

Apr 13, 2012

if i webbrowser1.navigate "[URL]" when this page was loaded then automatically navigate to [URL] i try webbrowser document completed event but still not working

View 4 Replies View Related

IDE :: MSAccess 2003 Report Holds Table Lock Thru Close And Deactivate Events?

Jan 27, 2010

For speed, I've decided to use temporary tables as the recordsource for a report. The problem occurs when I try and tidy up after the report is closed by trying to drop the temp table. Trying to do this using database.execute "DROP TABLE x" where x is the name of the temp table. Get a Run-time 3211 error that the table still has locks. I figured that any locks generated by the report would be dropped at least by the Deactivate event, but that doesn't seem to be the case. how to use a temp table in the report withot incurring an enduring table lock? The report is the sole user.

View 1 Replies View Related

2005 - Horizontal Scroll Event Not Working Properly

Jan 7, 2011

I am developing windows application in visual basic .net 2005. I am using datagridview and i want to handle its horizontal scroll event. i was using code below,


View 6 Replies View Related

Forms :: Tabcontrol1.tabpages.remove Not Working In A Particular Event)?

Jun 15, 2010

I have an event called "worksheet_selectionchanged" which occurs when a range/cell is selected in an excle file.When the event is triggered, all the tabpages in a tabcontrol should be removed.The code is given below:

Private Sub myWorksheet_SelectionChange(ByVal Target As Excel.Range) Handles myWorksheet.SelectionChange
for each tabpagesToRemove as TabPage in tabcontrol1.tabpages


but when ever i select a cell in the excel file, the tabpages seems to be "not removed".

View 4 Replies View Related

ItemCommand Event Of FormView Control Not Firing/working In ASP.Net Page

Jun 5, 2009

ItemCommand Event of FormView control not firing/working in ASP.Net Page

View 1 Replies View Related

VB2008 Express Form Load Event Not Working As Expected

Sep 23, 2009

I am working a building a form that is generated using Project|Add Windows Form|Form.

In the Load procedure, I placed the following code:
dbObject.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:scdbv4datascdbdata.mdb"
rsObject.CursorType = ADODB.CursorTypeEnum.adOpenKeyset


View 10 Replies View Related

Serial Port Data Read Event - Blinking Function Not Working

Jun 19, 2011

im using vb 2008 to read serial port data. my requirement is as follows, when the data is received from the serial port a timer is enabling in order to blink a button saying "tank empty". so i have written the code with the aid of this forums. but now my problem is the blinking button function is not working. first i thought its cuz timer is not enabling inside the serial_dataReceived event. so i invoked a dummy label. so the timer works. but its blinking function is not working.


View 3 Replies View Related

Copyrights 2005-15, All rights reserved