Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a program that I designed that pulls in data from an excel file using a datagridview in VB.net. Also my program is able to let me change the data via the datagridview and save the data back to the original excel file. I have created cell validations for certain cells, but I’m looking for a way to validate my data when I’m first reading the excel file. So if my excel file has a letter in a cell that only allows numbers I want the program to automatically replace the invalid cell data with a default value, which may be “0”. To help I’ve included some Pseudocode Below.

First I need to define some type of integer variable named invalidcell and initialize to 0 For each worksheet For each cell in each worksheet If an invalid cell is read, the invalid cell value is replaced by the default value and the invalidcell is incremented by 1.

End loop

End loop

Then when all the cells have been imported, display an error message if the invalidcell is > 0, that says how many invalidcells were found.

I greatly appreciate any help or suggestions anyone can give. Thanks so much ☺
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900