Events handling multiple controls

dpatfield66

Well-known member
Joined
Apr 6, 2006
Messages
136
Programming Experience
5-10
I have a FormatDate() routine that I call on the LostFocus Event for all my dates. If the entry in the control is an invalid date, the entry will become blank.

Rather than coding each individual date field on Lost Focus, I noticed that you can create one Event Handler that handles all my dates:

EX:
Private Sub Date_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAAdmitDate.LostFocus,txtAAdmitTime.LostFocus, txtALMP.LostFocus, (etc...)
-------------------------------------------------------------------
This works great when I want ALL my comboboxes to have .dropped down on Got Focus(). I'm using the reference Me.ActiveControl:
(Ex: Me.ActiveControl.droppeddown = True) but for LostFocus, the active control is the NEXT control (that gets tabbed into!) so I can't seem to do the above for LostFocus,I've even tried Leave, but it's the same.

How can I get the Event Handler for all my dates to wipe out the date, if it's invalid, and the user goes to another control (either by tab or mouse)?
 
My bad...I was trying to open it inside the zip file. I extracted it and have it now....I'll take a look at it.
 
Well, I'm baffled. It worked in your project, but not in mine!
I even changed mine back to GotFocus() rather than Enter().

But nothing happens when I execute. Do you think there's something new in 2005 I have to do?
 
I'd love to attatch my project here.

Please understand that I am just learning VB.NET and VS 2005, so I am sure that there are things here I could be doing better.

Baby steps, brother...baby steps!!

Actually, I just tried to attach my project as a zip and it said that it failed. Any suggestions.
 
Thanks for the tip. Actually, I did zip it and it still failed. It didn't say why it failed, like max size or anything like that. It just said "Failed"

Do you have a public email address I could send it to or whatever's more comfortable for you?
 
Back
Top