AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Rizwan Muhammad Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.

Experience
Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Function to Validate Filename

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 4/10/2007
Subject: Function to Validate Filename

Question
QUESTION: Hi All!
Im using VS 2005 on win Xp.
How to develope the code for the below Fuction in vb.net??
Public Function ValidateAISFile(filename as String) AS Integer

the return conditions are....
Return value      Description
0                     Everything is OK the file is valid for import

Return this value if you don’t get a match on the other conditions.
--------------------
1                     The file is already imported in the database.

Use combinations of IMO-number and timestamp on a few records in the import file and se if you find corresponding records in the current database.  Return 1 if you find a match.
------------------------------
2      The timestamp column contains a date outside valid range.

Compare the timestamp in the first and the last line in the import file and….
Return 2 if at least one of the dates is outside the range.
-----------------------------------
3      The number of columns in the AIS import file is not correct

Check if the number of columns is correct. Return 3 if the number is incorrect.
----------------------------------------
4      One or more columns in the AIS import file contain an incorrect data type.

Select a few (e.g. 10) sample rows from the AIS import file and type-check to find out if the columns have the correct data type. Return 4 if any of the columns have an incorrect type according to the specification.
----------------------------------------------------
Plz help me out.///
ANSWER: The algo looks pretty simple what exactly are you want me to help you with?

---------- FOLLOW-UP ----------

QUESTION: I jus want to know, how we can return values , check the file and and content to be match the return values...
Plz help me, and do ur code...

Answer
in VB.Net the function structure is like this:

Function REturnAValue(fileName as string) as Integer

'Use System.IO.File to process your file

'Use Return Keyword to return the values e.g.

If bolSuccess= true then
 Return 1
else
 Return 0
end if
End Function

Hope this is what you are asking.

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.