954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to validate the excel cell format in vb.net

Need help,

I need to know on how can VB.net validates the format of each cell on the excel file that it opens,
for example, the first row should only be numeric, or cannot be null,
is it possible that vb.net can check it before it inserts it in the dataset or data table?
how can it be done?

thanks

jbutardo
Junior Poster in Training
73 posts since Jan 2012
Reputation Points: 8
Solved Threads: 1
 

As far as I know there is no validation done. Even in Excel things are lax. For example, if you set the format for a cell in Excel to "currency", Excel will not prevent you from entering a string (or even warn you). At least not in Excel 2003 (I don't know about newer versions).

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 
As far as I know there is no validation done. Even in Excel things are lax. For example, if you set the format for a cell in Excel to "currency", Excel will not prevent you from entering a string (or even warn you). At least not in Excel 2003 (I don't know about newer versions).


so is there a way that the vb.net can validate the data from the excel file?

if so, how can it be done?

thanks

jbutardo
Junior Poster in Training
73 posts since Jan 2012
Reputation Points: 8
Solved Threads: 1
 

You can validate any data as long as you know what that data is supposed to be. If you are asking how to determine what formatting was set for a particular cell in the spreadsheet then I don't know. If you are importing data from a spreadsheet into VB then you should already have some idea of what format the data should be in so you shouldn't need to know the Excel formatting.

In any case. it may be afternoon in Rizal but it is after midnight here so I'm off to bed.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

You can validate any data as long as you know what that data is supposed to be. If you are asking how to determine what formatting was set for a particular cell in the spreadsheet then I don't know. If you are importing data from a spreadsheet into VB then you should already have some idea of what format the data should be in so you shouldn't need to know the Excel formatting.

In any case. it may be afternoon in Rizal but it is after midnight here so I'm off to bed.


okay, thanks.. i already found a solution..

jbutardo
Junior Poster in Training
73 posts since Jan 2012
Reputation Points: 8
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: