devxlogo

InteractiveChange in Grid

InteractiveChange in Grid

Question:
I have a column in a grid that is of the data type date. In the InteractiveChange event, I have a code that takes the value entered in the grid cell and moves it to an array. Since the column is defined to hold dates, every time I enter a keystroke, the InteractiveChange fires. Because the event fires before I complete typing the date, I get an invalid date error.

Is there another place I can put my code so that the code is executed after I have completed typing the whole date?

Answer:
As you are finding out, the InteractiveChange event fires whenever the value of the controlsource of a control changes. You need to use the Valid method of the control in the column. The Valid method fires whenever you attempt to leave a control and allows you to validate data and event to prevent leaving the control.

Try putting the code that adds to the array into the Valid method.

See also  How College Students Can Shape the Future of Tech Responsibility
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist