Last post Aug 11, 2009 04:23 PM by rtpHarry
Aug 11, 2009 12:07 PM|vb89|LINK
I'm trying to create a validation program which entails throwing everything in a csv file that i have into array and then looping through it and doing a comparison.
Here is some of my preexisting code which currently finds the name of a file that I want to do a comparison off by basically using a InStrRev function ...
Private Function getFileName(ByVal tProcessDir As String, ByVal tARZ FileName As String) As String
Dim tXSDName As String
Dim tSingleLetterCheck As String
Dim ii As Short
Dim ii2 As Short
tXSDName = tXSDFileName
ii = InStrRev(tXSDName, "_") + 1
tSingleLetterCheck = VB.LCase(Mid(tXSDName, ii))
If Len(tSingleLetterCheck) = 1 Then
ii2 = InStrRev(tXSDName, "_", ii - 2) - 1
tXSDName = Mid(tXSDName, 1, ii2)
ii = InStr(tXSDName, "_ARZ") - 1
If ii <> -1 Then
tXSDName = Mid(tXSDName, 1, ii)
ii = InStr(tXSDName, "_HIST") - 1
ii = InStrRev(tXSDName, "_")
If Mid(tXSDName, ii) = "_TT" Then
tXSDName = Mid(tXSDName, 1, ii - 1)
What i would like to do is have this function store everything from my file_names.csv file into an array and just loop through the array to match the appropriate filename to the appropriate file. Hopefully that made sense. Any idea on how to go about this
would be appreciated as I've never done anything like this before.
Aug 11, 2009 04:23 PM|rtpHarry|LINK
This looks like old school vb6 code. Are you importing Microsoft.VisualBasic at the top of your page?
This is an old way to do things.
If you are developing in asp.net 3.5 environment then you could use LinqToCsv to provide powerful query features that will let you get at the data you want.