Validating Input Data in LostFocus

Validating Input Data in LostFocus

I have two fields on the screen that I use to enter a date range. I want to check the entry on the lost focus with IsDate, and in the event that IsDate = False, inform the user, set the Focus back on the field, and ExitSub before I continue. Since the ending date field follows in the tab sequence, the resulting behavior is that it shows a message box from each control that that date does not work. To the user it just looks as if ithe same message box comes up twice. Any suggesstions, and will VB 4.0 work better.

There’s an inherent problem in what you are doing. LostFocus is a good place to do validation, as you’ve already seen. Unfortunately, you can’t set focus back to the box for the following reason: let’s say that the user pressed something into the box, got an error, and wants to cancel. The user will get a second error when the lostfocus event happens again when he/she goes to click the Cancel button. But since the lostfocus event will put focus back to the box, the user won’t be able to exit. You should probably set a variable if the validation fails, and check the value before committing the data.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing