Hi!

I have a real simple problem :) I wrote an application in VB.NET and I need to loop through multiple files. Now my code looks like this:

Private Files() As String = System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe")

which allows only one file to be opened. I have 12 such files in the directory and I would like to transform the above function to be able to load 12 files. in the old VB i did it like this:

Setfilename = "DirName"                  ' sets the file directory from where the images are loaded
Filepath = "filesDirectory\" + Setfilename + "\"                      ' get in hard-code the directory path
Filename = Filepath + "B0012.spe"                                    ' get the first file in the folder
Tsteps = 12                                                          ' numbers of images that are processed
Bin = 512 / 16                                                       ' binned pixels (gives also the matrix real dimensions in cm)

Can someone please help with this problem.

Thanks in advance

One way to do it is with a For loop (however, I believe VB.NET does offer controls that work with directories automatically).

I created a new project real quick, with one Form. I placed a ListBox (ListBox1) and a Button (Button1) in the form. the ListBox I am using to load the list of files into. Then I created a subroutine named loadFiles (this isn't necessary, you could simply place the code from loadFiles into the Button1_click event).

Here is the code for the loadFiles subroutine:

Private Sub loadFiles()
        Dim fileCount As Integer = System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe").Length
        Dim arrFiles() As String = System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe")
        Dim i As Integer
        For i = 0 To fileCount - 1
            Dim currentFile As String = arrFiles(i)
            ListBox1.Items.Add(currentFile)
        Next

    End Sub

In the code, I declared a variable "fileCount" which is the length of the amount of files located in the specified directory.
Next I declared an array "arrFiles" and assigned it to System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe"). What this does is take all of the data and place it into an array.
then declared "i" as integer to be used for the loop, and set up the For loop: "For i = 0 To fileCount - 1"
declared another variable "currentFile" inside the loop which is assigned to the index "i" of the arrFiles array.
then finally add currentFile to ListBox1

then I placed "loadFiles()" inside the Button1_click event.

this code adds the name of each file in the directory (including its path) to the listbox.

Hope that helps.

Thanks diyerxa for the quick response!

I place now the entire code for the application. Initially was made in VB6 and now ported to .NET.

'array with all "*.SPE" files in data directory

    'Private [B]Files()[/B] As String = System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe")
    Private Sub loadFiles()
        Dim fileCount As Integer = System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe").Length
        Dim arrFiles() As String = System.IO.Directory.GetFiles(My.Application.Info.DirectoryPath & "\Data", "*.spe")
        Dim i As Integer
        For i = 0 To fileCount - 1
            Dim currentFile As String = arrFiles(i)
            ListBox1.Items.Add(currentFile)
        Next

    End Sub

Private Sub frmSPE_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim fN As Integer, fM As Integer = [B]UBound(Files)[/B]            'the number of "*.SPE" files in directory
        If fM = -1 Then MsgBox("no *.SPE are found..." & Chr(13) & "By!", MsgBoxStyle.Information) : End

        Dim Ch As Integer = FreeFile()                              'free channel number for data file access
        Dim Xn, Yn, Zn, Xm, Ym, Zm As Integer, DataType As Short    'important header data (version 1.6)
        Dim Data(0) As Single, Data1(0) As Integer, Data2(0) As Short
        Dim fTime(0), fFreq(0) As SCplx
        Dim Ampl(0, 0, 0) As Single, fA As Byte, fAname As String   'amplitude matrix
        Dim oFile As System.IO.StreamWriter, Word As String
        For fN = 0 To fM
            FileOpen(Ch, [B]Files(fN)[/B], OpenMode.Binary, OpenAccess.Read)
            'read the header data (version 1.6)
            FileGet(Ch, DataType, 43)                               'xdim
            If DataType < 0 Then : Xm = 65535 + DataType : Else : Xm = DataType : End If
            FileGet(Ch, DataType, 657)                              'ydim
            If DataType < 0 Then : Ym = 65535 + DataType : Else : Ym = DataType : End If
            FileGet(Ch, Zm, 1447)                                   'NumFrames
            FileGet(Ch, DataType, 109)                              'datatype
            Select Case DataType
                Case 0      'Single
                    ReDim Data(Xm * Ym * Zm - 1) : FileGet(Ch, Data, 4101)
                Case 1      'Integer
                    'read data from file
                    ReDim Data(Xm * Ym * Zm - 1), Data1(Xm * Ym * Zm - 1) : FileGet(Ch, Data1, 4101)
                    For Xn = 0 To Xm * Ym * Zm - 1
                        Data(Xn) = Data1(Xn)
                    Next Xn
                Case Else   'Short
                    'read data from file
                    ReDim Data(Xm * Ym * Zm - 1), Data2(Xm * Ym * Zm - 1) : FileGet(Ch, Data2, 4101)
                    For Xn = 0 To Xm * Ym * Zm - 1
                        If Data2(Xn) < 0 Then : Data(Xn) = 65535 + Data2(Xn) : Else : Data(Xn) = Data2(Xn) : End If
                    Next Xn
            End Select
            FileClose(Ch)

As you see the files() was previously declared. I need to update the rest of the code to match the value of the previous files. It will be nice if you could help me to finish this task.

Many thanks for the support until now!

my code reads files in directory and process them. It also writes into files created. what i need now is for it to monitor the directory for new files all the time and only take intervals of 10 seconds. please help.

Imports System
Imports System.Data
Imports MySql.Data.MySqlClient
Imports System.IO
Imports System.Diagnostics

Module Module1

Dim myConnection As MySqlConnection
Dim MySQLConnectionString As String
Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
Dim FILE_NAME As String = Nothing
Dim dir As String = "C:\Mytest\"
Dim strDate As String = Nothing
Dim serv_type As String = Nothing
Dim strSubservice As String = Nothing
Dim member_no As String = Nothing
Dim strIndicator As String = Nothing
Dim strDirection As String = Nothing
Dim file_num As String = Nothing
Dim origin As String = Nothing
Dim transac_Type As String
Dim beginDayAck As String = "51"
Dim beginDayNack As String = "61"
Dim fileAck As String = "52"
Dim fileNack As String = "62"
Dim endDayAck As String = "59"
Dim endDayNack As String = "69"
Dim error_code As String
Dim recID As String = "00"
Dim num_records As String
Public watchfolder As FileSystemWatcher



Sub Main(ByVal args As String())


    MySQLConnectionString = "Server=localhost;" & _
                        "Database=lebo_test;" & _
                        "Userid=root;" & _
                        "Password=12345;"
    myConnection = New MySqlConnection(MySQLConnectionString)


    For i As Integer = 0 To CommandLineArgs.Count - 1
        If i = 0 Then
            FILE_NAME = (CommandLineArgs(i))
        End If

    Next



        Dim last_char As String = FILE_NAME.Substring(7, 1)
        Dim last_three As String = FILE_NAME.Substring(5, 3)
        Console.WriteLine("lastchar is: " + last_char)

        If (last_char.Equals("D")) Then
            Console.WriteLine("here")
            Data_Validation()
        Else
            If (last_three.Equals("Z1C")) Then
                Z1C()

            ElseIf (last_three.Equals("Z9C")) Then
                Z9C()
            Else
                '    Call Z7C()
            End If
        End If



End Sub

Public Sub Nack(ByRef error_code As String)

    Dim NACKFILE As String = FILE_NAME.Substring(0, 7) + "N"

    Using writer As StreamWriter = New StreamWriter(dir + "\output\" + NACKFILE, False)
        writer.Write(recID + transac_Type + strDate + serv_type + " " + strSubservice + " " + " " + member_no +
        origin + strDirection + " " + strIndicator + (FILE_NAME.Substring(0, 7) + "N") + file_num + error_code)
    End Using

    'FileOpen(1, dir + NACKFILE, OpenMode.Output)
    'PrintLine(1, "lebo testing")
    'PrintLine(1, "LEBO AGAIN and AGAIN LEBO")
    'FileClose(1)

End Sub

Public Sub Ack(ByRef error_code As String)

    Dim ACKFILE As String = FILE_NAME.Substring(0, 7) + "A"

    Using writer As StreamWriter = New StreamWriter(dir + "\output\" + ACKFILE, False)
        writer.Write(recID + transac_Type + strDate + serv_type + " " + strSubservice + " " + member_no +
        origin + strDirection + " " + strIndicator + (FILE_NAME.Substring(0, 7) + "A") + file_num + error_code)
    End Using
End Sub
Public Sub Data_Validation()

    'Dim FILE_NAME As String = Nothing
    '"C:\Users\LebohangL\Desktop\Lebo\DEND001D"
    'Dim dr As String = "C:\Users\LebohangL\Desktop\Lebo"
    Dim TextLine As String = Nothing
    Dim num As Integer = 0
    'Dim strDate As String = Nothing
    Dim processing_date As String = Nothing
    'Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
    Dim service_type As String = Nothing
    'Dim serv_type As String = Nothing
    'Dim strSubservice As String = Nothing
    Dim subservice As String = Nothing
    Dim indicator As String = Nothing
    Dim direction As String = Nothing
    'Dim strIndicator As String = Nothing
    'Dim strDirection As String = Nothing
    Dim user_no As String = Nothing
    'Dim member_no As String = Nothing
    Dim recordID As String = Nothing
    Dim executeDA As MySqlDataAdapter
    Dim datacombo As New DataTable
    'Dim myConnection As MySqlConnection
    'Dim MySQLConnectionString As String
    'MySQLConnectionString = "Server=localhost;" & _
    '                    "Database=lebo_test;" & _
    '                    "Userid=root;" & _
    '                    "Password=12345;"
    'myConnection = New MySqlConnection(MySQLConnectionString)


    'For i As Integer = 0 To CommandLineArgs.Count - 1
    '      If i = 0 Then
    '        FILE_NAME = (CommandLineArgs(i))
    '    End If

    'Next
    datacombo = New DataTable



    If System.IO.File.Exists(dir + FILE_NAME) = True Then
        Dim objReader As New System.IO.StreamReader(dir + FILE_NAME)

        'reading the txt file
        Do While objReader.Peek() <> -1
            num += 1
            TextLine = objReader.ReadLine()

            If num = 1 Then
                serv_type = TextLine.Substring(10, 4).Trim
                strSubservice = TextLine.Substring(14, 10).Trim
                strDate = TextLine.Substring(2, 8)
                member_no = TextLine.Substring(24, 4)
                strIndicator = TextLine.Substring(59, 4)
                strDirection = TextLine.Substring(48, 3).Trim
                file_num = TextLine.Substring(40, 4)
                origin = TextLine.Substring(28, 4)
                recordID = TextLine.Substring(0, 2)
            End If

            'get number of records
            If num > 1 Then
                recordID = TextLine.Substring(0, 2)
            End If
            If recordID = "99" Then
                num_records = TextLine.Substring(28, 6)
                num_records = Val(num_records)

                Exit Do
            End If

        Loop


        Dim recNum As String = num
        Console.WriteLine(recNum)
        Console.WriteLine("Number of records are " + num_records)

        If recNum.ToString <> num_records.ToString Then
            transac_Type = fileNack
            Nack("22")
            Console.WriteLine("ERROR 22!!Invalid number of records")
            Exit Sub
        End If

        'Verify Service and continue validation
        Dim sqlcmd = "SELECT service_type from service where service_type = '" + serv_type + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("****************")
            Console.WriteLine("*Dataset Empty*")
            Console.WriteLine("****************")
        Else

            Dim dtRow As DataRow

            For Each dtRow In datacombo.Rows
                'subservice = dtRow("subservice")
                service_type = dtRow("service_type")

            Next
        End If



        Console.WriteLine("FileService type is: " + serv_type)

        Console.WriteLine("Service type is : " + service_type)

        If (serv_type.Equals(service_type)) Then
            transac_Type = fileAck
            'Ack("00")
            Console.WriteLine("Service Valid. Check Processing date to proceed")

        Else

            'Console.WriteLine("NACK NACK")
            transac_Type = fileNack
            Nack("03")
            Console.WriteLine("ERROR 03!! Invalid service")
            Exit Sub
        End If

        'Verify processing date
        sqlcmd = "SELECT processing_date from cleanup where service_type = '" + serv_type + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("****************")
            Console.WriteLine("Dataset Empty")
            Console.WriteLine("****************")
        Else
            For Each dtRow In datacombo.Rows
                processing_date = dtRow("processing_date")
            Next
        End If

        Console.WriteLine("File Processing Date is: " + strDate)

        Console.WriteLine("Processing Date  is : " + processing_date)

        If strDate.ToString.Equals(processing_date) Then
            transac_Type = fileAck
            'Ack("00")
            Console.WriteLine("Processing_date Valid.")

        Else

            transac_Type = fileNack
            Nack("02")
            Console.WriteLine("ERROR 02!! Invalid processing_date")
            Exit Sub
        End If

        'Is member setup for service
        sqlcmd = "SELECT user_no, service_type, subservice, direction, indicator FROM client where user_no = '" + member_no + "' AND service_type ='" + serv_type + "' AND subservice ='" + strSubservice + "' AND direction ='" + strDirection + "' AND indicator ='" + strIndicator + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("***********************************************")
            Console.WriteLine("Dataset Empty.Member not setup on client table")
            Console.WriteLine("***********************************************")
        Else

            For Each dtRow In datacombo.Rows
                user_no = dtRow("user_no")
                service_type = dtRow("service_type")
                subservice = dtRow("subservice")
                direction = dtRow("direction")
                indicator = dtRow("indicator")

            Next
        End If

        Console.WriteLine("File user number is: " + member_no)

        Console.WriteLine("User number is : " + user_no)

        Console.WriteLine("FileService type is: " + serv_type)

        Console.WriteLine("Service type is : " + service_type)
        Console.WriteLine("File subservice is:" + strSubservice)

        Console.WriteLine("Subservice is:" + subservice)

        Console.WriteLine("File direction is:" + strDirection)

        Console.WriteLine("Direction is:" + direction)

        Console.WriteLine("File indicator is:" + strIndicator)

        Console.WriteLine("Indicator is:" + indicator)



        If (member_no.ToString.Equals(user_no)) And (serv_type.Equals(service_type)) And (strDate.Equals(processing_date)) And (strSubservice.ToString.Equals(subservice)) And (strDirection.ToString.Equals(direction)) And (strIndicator.ToString.Equals(indicator)) Then

            transac_Type = fileAck
            Ack("00")
            Console.WriteLine("Member configured.")
        Else

            transac_Type = fileNack
            Nack("04")

            Console.WriteLine("ERROR 04!! Member not configured")

        End If
        Exit Sub
    Else
        Nack("92")

    End If
End Sub

Public Sub Z1C()

    Dim TextLine As String
    Dim num As Integer = 0
    Dim processing_date As String = Nothing
    Dim service_type As String = Nothing
    Dim subservice As String = Nothing
    Dim indicator As String = Nothing
    Dim direction As String = Nothing
    Dim user_no As String = Nothing
    Dim executeDA As MySqlDataAdapter
    Dim datacombo As New DataTable
    datacombo = New DataTable


    If System.IO.File.Exists(dir + FILE_NAME) = True Then
        Dim objReader As New System.IO.StreamReader(dir + FILE_NAME)

        Do While objReader.Peek() <> -1
            num += 1
            TextLine = objReader.ReadLine()

            If num = 1 Then
                serv_type = TextLine.Substring(12, 4).Trim
                strSubservice = TextLine.Substring(16, 10).Trim
                strDate = TextLine.Substring(4, 8)
                member_no = TextLine.Substring(26, 4)
                strIndicator = TextLine.Substring(37, 4)
                strDirection = TextLine.Substring(34, 3).Trim
                origin = TextLine.Substring(30, 4)
                transac_Type = TextLine.Substring(2, 4)
            End If
        Loop


        'Verify Service and continue validation
        Dim sqlcmd = "SELECT service_type from service where service_type = '" + serv_type + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("****************")
            Console.WriteLine("Dataset Empty")
            Console.WriteLine("****************")
        Else

            Dim dtRow As DataRow

            For Each dtRow In datacombo.Rows
                'subservice = dtRow("subservice")
                service_type = dtRow("service_type")

            Next
        End If

        Console.WriteLine("FileService type is: " + serv_type)

        Console.WriteLine("Service type is : " + service_type)

        If (serv_type.Equals(service_type)) Then
            transac_Type = beginDayAck
            'Ack("00")

            Console.WriteLine("Service Valid. Check Processing date to proceed")
        Else

            'Console.WriteLine("NACK NACK")
            transac_Type = beginDayNack
            Nack("03")

            Console.WriteLine("ERROR 03!! Invalid service")
            Exit Sub
        End If

        'Verify processing date
        sqlcmd = "SELECT processing_date from cleanup where service_type = '" + serv_type + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("****************")
            Console.WriteLine("Dataset Empty")
            Console.WriteLine("****************")
        Else
            For Each dtRow In datacombo.Rows
                processing_date = dtRow("processing_date")
            Next
        End If

        Console.WriteLine("File Processing Date is: " + strDate)

        Console.WriteLine("Processing Date  is : " + processing_date)

        If strDate.ToString.Equals(processing_date) Then

            transac_Type = beginDayAck
            'Ack("00")
            Console.WriteLine("Processing_date Valid.")
        Else

            transac_Type = beginDayNack
            Nack("02")
            Console.WriteLine("ERROR 02!! Invalid processing_date")
            Exit Sub
        End If

        'Is member setup for service
        sqlcmd = "SELECT user_no, service_type, subservice, direction, indicator FROM client where user_no = '" + member_no + "' AND service_type ='" + serv_type + "' AND subservice ='" + strSubservice + "' AND direction ='" + strDirection + "' AND indicator ='" + strIndicator + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("***********************************************")
            Console.WriteLine("Dataset Empty.Member not setup on client table")
            Console.WriteLine("***********************************************")
        Else

            For Each dtRow In datacombo.Rows
                user_no = dtRow("user_no")
                service_type = dtRow("service_type")
                subservice = dtRow("subservice")
                direction = dtRow("direction")
                indicator = dtRow("indicator")

            Next
        End If

        Console.WriteLine("File user number is: " + member_no)

        Console.WriteLine("User number is : " + user_no)

        Console.WriteLine("FileService type is: " + serv_type)

        Console.WriteLine("Service type is : " + service_type)
        Console.WriteLine("File subservice is:" + strSubservice)

        Console.WriteLine("Subservice is:" + subservice)

        Console.WriteLine("File direction is:" + strDirection)

        Console.WriteLine("Direction is:" + direction)

        Console.WriteLine("File indicator is:" + strIndicator)

        Console.WriteLine("Indicator is:" + indicator)



        If (member_no.ToString.Equals(user_no)) And (serv_type.Equals(service_type)) And (strDate.Equals(processing_date)) And (strSubservice.ToString.Equals(subservice)) And (strDirection.ToString.Equals(direction)) And (strIndicator.ToString.Equals(indicator)) Then
            transac_Type = beginDayAck
            Ack("00")

            Console.WriteLine("Member configured.")
        Else

            transac_Type = beginDayNack
            Nack("04")
            Console.WriteLine("ERROR 04!! Member not configured")
            Exit Sub

        End If
    Else
        Nack("92")
    End If



End Sub

Public Sub Z9C()


    Dim TextLine As String
    Dim num As Integer = 0
    Dim processing_date As String = Nothing
    Dim service_type As String = Nothing
    Dim subservice As String = Nothing
    Dim indicator As String = Nothing
    Dim direction As String = Nothing
    Dim user_no As String = Nothing
    Dim executeDA As MySqlDataAdapter
    Dim datacombo As New DataTable
    datacombo = New DataTable


    If System.IO.File.Exists(dir + FILE_NAME) = True Then
        Dim objReader As New System.IO.StreamReader(dir + FILE_NAME)

        Do While objReader.Peek() <> -1
            num += 1
            TextLine = objReader.ReadLine()

            If num = 1 Then
                serv_type = TextLine.Substring(12, 4).Trim
                strSubservice = TextLine.Substring(16, 10).Trim
                strDate = TextLine.Substring(4, 8)
                member_no = TextLine.Substring(26, 4)
                strIndicator = TextLine.Substring(37, 4)
                strDirection = TextLine.Substring(34, 3).Trim
                origin = TextLine.Substring(30, 4)

            End If
        Loop

        'Verify Service and continue validation
        Dim sqlcmd = "SELECT service_type from service where service_type = '" + serv_type + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("****************")
            Console.WriteLine("Dataset Empty")
            Console.WriteLine("****************")
        Else

            Dim dtRow As DataRow

            For Each dtRow In datacombo.Rows
                'subservice = dtRow("subservice")
                service_type = dtRow("service_type")

            Next
        End If

        Console.WriteLine("FileService type is: " + serv_type)

        Console.WriteLine("Service type is : " + service_type)

        If (serv_type.Equals(service_type)) Then
            transac_Type = endDayAck
            'Ack("00")
            Console.WriteLine("Service Valid. Check Processing date to proceed")

        Else
            transac_Type = endDayNack
            Nack("03")
            Console.WriteLine("ERROR 03!! Invalid service")

            Exit Sub
        End If

        'Verify processing date
        sqlcmd = "SELECT processing_date from cleanup where service_type = '" + serv_type + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("****************")
            Console.WriteLine("Dataset Empty")
            Console.WriteLine("****************")
        Else
            For Each dtRow In datacombo.Rows
                processing_date = dtRow("processing_date")
            Next
        End If

        Console.WriteLine("File Processing Date is: " + strDate)

        Console.WriteLine("Processing Date  is : " + processing_date)

        If strDate.ToString.Equals(processing_date) Then
            transac_Type = endDayAck
            Ack("00")

            Console.WriteLine("Processing_date Valid.")
        Else

            transac_Type = endDayNack
            Nack("02")

            Console.WriteLine("ERROR 02!! Invalid processing_date")
            Exit Sub
        End If

        'Is member setup for service
        sqlcmd = "SELECT user_no, service_type, subservice, direction, indicator FROM client where user_no = '" + member_no + "' AND service_type ='" + serv_type + "' AND subservice ='" + strSubservice + "' AND direction ='" + strDirection + "' AND indicator ='" + strIndicator + "'"
        executeDA = New MySqlDataAdapter(sqlcmd, myConnection)
        datacombo.Clear()
        executeDA.Fill(datacombo)

        If datacombo.Rows.Count = 0 Then
            Console.WriteLine("***********************************************")
            Console.WriteLine("Dataset Empty.Member not setup on client table")
            Console.WriteLine("***********************************************")
        Else

            For Each dtRow In datacombo.Rows
                user_no = dtRow("user_no")
                service_type = dtRow("service_type")
                subservice = dtRow("subservice")
                direction = dtRow("direction")
                indicator = dtRow("indicator")

            Next
        End If

        Console.WriteLine("File user number is: " + member_no)

        Console.WriteLine("User number is : " + user_no)

        Console.WriteLine("FileService type is: " + serv_type)

        Console.WriteLine("Service type is : " + service_type)

        Console.WriteLine("File subservice is:" + strSubservice)

        Console.WriteLine("Subservice is:" + subservice)

        Console.WriteLine("File direction is:" + strDirection)

        Console.WriteLine("Direction is:" + direction)

        Console.WriteLine("File indicator is:" + strIndicator)

        Console.WriteLine("Indicator is:" + indicator)


        If (member_no.ToString.Equals(user_no)) And (serv_type.Equals(service_type)) And (strSubservice.ToString.Equals(subservice)) And (strDirection.ToString.Equals(direction)) And (strIndicator.ToString.Equals(indicator)) Then

            transac_Type = endDayAck
            Ack("00")

            Console.WriteLine("Member configured.")
        Else
            transac_Type = endDayNack
            Nack("04")

            Console.WriteLine("ERROR 04!! Member not configured")
        End If

        Exit Sub
    Else
        Nack("92")
    End If
End Sub

Don't post on 4 year old threads. Start another thread if you have a question you need to ask.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.