Group,

You've helped me write a routine that merges and formats a text file when multiple files exist. The code is as follows:

                If fileCount = 3 Then
                    RestranName = getRestranName(0)
                    RestranName2 = getRestranName(1)
                    RestranName3 = getRestranName(2)
                    Dim readtxt() As String = File.ReadAllLines(RestranName)
                    'Deleted the actual file.
                    File.Delete(RestranName)
                    'Now time to read the array elements and save them in a file.
                    For i As Integer = readtxt.GetLowerBound(0) To readtxt.GetUpperBound(0) - 4
                        'Appending the line to the text file
                        My.Computer.FileSystem.WriteAllText(RestranName, readtxt(i), True)
                        If i < readtxt.GetUpperBound(0) - 4 Then
                            'Appending a new line into the text file.
                            My.Computer.FileSystem.WriteAllText(RestranName, vbCrLf, True)
                        End If
                    Next
                    My.Computer.FileSystem.WriteAllText(RestranName, pageCode, True)


                    Me.Cursor = Cursors.Default
                    Dim readtxt2() As String = File.ReadAllLines(RestranName2)
                    'Deleted the actual file.
                    File.Delete(RestranName2)
                    'Now time to read the array elements and save them in a file.
                    For i As Integer = readtxt2.GetLowerBound(0) To readtxt2.GetUpperBound(0) - 4
                        'Appending the line to the text file
                        My.Computer.FileSystem.WriteAllText(RestranName2, readtxt2(i), True)
                        If i < readtxt2.GetUpperBound(0) - 4 Then
                            'Appending a new line into the text file.
                            My.Computer.FileSystem.WriteAllText(RestranName2, vbCrLf, True)
                        End If
                    Next
                    My.Computer.FileSystem.WriteAllText(RestranName2, pageCode, True)
                    File.AppendAllText(RestranName, System.IO.File.ReadAllText(RestranName2))
                    File.AppendAllText(RestranName, File.ReadAllText(RestranName3))
                    File.Delete(RestranName2)
                    File.Delete(RestranName3)
                End If

                ' setting the path name to save the converted file
                fileSave = "O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels\" & hotelFolder & "\Restran\" & propertyNo & "Restran.txt"
                ' Getting date extension to save the file in a history 

                yesterday = Today.AddDays(-1)
                day = yesterday.Day.ToString
                month = yesterday.Month.ToString
                year = yesterday.Year.ToString
                year = year.Substring(2, 2)
                If yesterday.Day < 10 Then
                    day = "0" & day
                End If
                    If yesterday.Month < 10 Then
                    month = "0" & month
                End If
                copyFile = "O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels\" & hotelFolder & "\Restran\Restran History\" & propertyNo & " Restran " & month & day & year & ".txt"
                ' This reads the text file for conversion
                txtLine = My.Computer.FileSystem.ReadAllText(RestranName)
                ' This begins to add the carriage returns in the appropriate places
                txtLine = Replace(txtLine, pageCode, vbCrLf & pageCode)
                txtLine = Replace(txtLine, vbLf, vbCrLf)
                txtLine = Replace(txtLine, vbCr & vbCr, vbCr)
                txtLine = Replace(txtLine, """", "")
                ' This writes the line to the file
                My.Computer.FileSystem.WriteAllText(fileSave, txtLine, False)
                System.IO.File.Copy(fileSave, copyFile)
                ' This deletes the old unconverted file
                System.IO.File.Delete(RestranName)

My latest issue has to do whether the program is actually stopped or not. During run-time, I'm getting a notice at the top of the user interface (next to the program name) that the program has stopped. This is only happening on days were there are multiple text files to merge.

Given what the code is doing on these days, it's taking several minutes to go through the routine. You probably need to know the routine is looping multiple times to capture the next property number in the sequence. Generally after the 1st or second property (truthfully I can't actually tell when it's saying it's stopped), is when I get the notice that it's stopped. But then again, has it really? I say that as it seems to be going through the routine but I never get the message that says it's completed the tasks.

I'm sure someone has seen this before. Any thoughts on how to make sure everything runs correctly and completely? FYI... it runs perfectly and very quickly when there is only one text file to format in each property folder.

Thoughts?

Thanks for the help.

Don

The usual approach is to add

Debug.WriteLine("stuff")

lines at strategic places inside the loop, then run the code to see what is happening. Either that or step through the code in the debugger with breakpoints.

By the way, a shorter method of adding a leading zero is the Format function as in

Dim month As String = Format(yesterday.Month, "00")

Edited 1 Year Ago by Reverend Jim

It sounds like the Windows message that occurs during long running tasks. This occurs because you are executing the long running task on the main thread. The long running operation can occur for multiple reasons. One reason is because it takes that long to complete. Another reason could be resource contention. You should use BackgroundWorkerThread for long running operations.

See the following:
How to use BackGroundWorker to Create Threads

Edited 1 Year Ago by cgeier

Nothing in that code looks like it requires the complexity of a background thread, especially considering the ability of the OP. Debugging a single threaded program can be difficult enough.

Don - would it be possible for you to upload all three data files?

Hi Don

For a colleague still at work I was happy to do a somewhat similar job as yours.
I used an extra dialogwindow with a label with as text a notice which file was being processed. This dialog also had a progressbar control.
Maybe this is something you might be looking for?

Based on his level of expertise, I would suggest NOT adding complexity by involving additional controls, especially ones that did not come with VB. Adding print statements (in this case Debug.WriteLine) is the simplest method.

If your program fails, how can you re-run it if you delete the original files or overwrite them?

Edited 1 Year Ago by cgeier

Sorry for the delay in responding. It's been an extremely busy week.

I believe the idea of debug.writeline is the best approach to finding where it may be stopping. I didn't think the program was overly complex either, but when it is deleting lines and merging more than two or three files, it really boggs down. On Monday I'll upload the three individual files that are to be merged. I'll also do a "after" merge upload for you to see.

Thinking out loud - I'll also drop the whole code into a text file so you can see everything I've done. Feel free to offer ideas on how to improve any portion of the program. Clearly I'm very inexperienced and have minimal training (two online courses in VB at my local college). I'd love to improve to the point that I might be useful to someone!

Group, thanks for all you do. You're the best!

Don

Group,

I'm attaching the three files that are to be merged. The fourth is the merged file. While merging these files I again got the message that the program wasn't responding. However it eventually went through - just not as quickly as I thought it should.

I'm also attaching the complete code. Feel free to critique it. I'm sure there are things that I could have done more efficiently and cleaner. Feel free to offer suggestions.

Thanks for your interest. I certainly appreciate your help!

Don

Attachments
Four Points Eastham                                Reservation Transaction Report                              Page Number:    1
Denise Zevitas                                             For 01-MAR-2015                                 01-MAR-2015 01:28 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

02-MAR-15 NEW    T    Leblanc, Allison               K     AUTODEAL         99.00  1  0  0  VI   xxxxx8875                xx-xx
03-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: STARUSER

04-MAR-15 NEW    T    Russell, Steve                 PDD   LDAILY0         114.75  1  0  0  AX   xxxxx2429                xx-xx
05-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1: 44524351     AR Account:          Agent #: 9999

20-MAR-15 NEW    G    Perru, Scott                   PDD   G149            149.00  2  0  0  VI   xxxxx3704                xx-xx
22-MAR-15 Group: SQUIRT CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: KRISTAE

21-MAR-15 NEW    T    Childs, Nelli                  K     DAILY21         157.50  2  0  0  AX   xxxxx4005                xx-xx
22-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: 9999

21-MAR-15 NEW    T    Proulx, Erin                   PDD   DAILY21         157.50  1  0  0  MC   xxxxx2826                xx-xx
22-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: 9999

10-APR-15 MOD    G    Freitas, Feliciano             PDD   G89              89.00  2  0  0  MC   xxxxx8897                xx-xx
12-APR-15 Group: PLYMOU CFTID:          Source: SA   Market Seg: SOC  IATA #1:              AR Account:          Agent #: TABITHA

19-APR-15 NEW    T    Hausenbauer, Kathleen          PDD   PLINE4           81.00  2  0  0  MC   xxxxx1444                xx-xx
22-APR-15 Group:        CFTID:          Source: 1P   Market Seg: TOP  IATA #1: 7508546      AR Account:          Agent #: 9999

22-APR-15 MOD    T    Finacom, Elizabeth             PDD   SETAUTOF        139.50  2  0  0  VI   xxxxx1667                xx-xx
24-APR-15 Group:        CFTID:          Source: CI   Market Seg: QD   IATA #1:              AR Account:          Agent #: TABITHA

25-APR-15 MOD    G    Blackman, Barbara              OQQ   G119            119.00  2  0  0  DI   xxxxx8382                xx-xx
27-APR-15 Group: XAVIER CFTID:          Source: SA   Market Seg: WRB  IATA #1:              AR Account:          Agent #: TABITHA

22-MAY-15 MOD    T    Coldwell, Eric                 OQQ   AUTOV           282.00  2  0  2  MC   xxxxx8452                xx-xx
25-MAY-15 Group:        CFTID:          Source: NTF  Market Seg: QD   IATA #1:              AR Account:          Agent #: TABITHA

05-JUL-15 MOD    G    Albert, Joe                    PDD   NEEI2           225.00  1  0  0  MC   xxxxx1679                xx-xx
10-JUL-15 Group: NEEI3  CFTID:          Source: NEEI Market Seg: NEEI IATA #1:              AR Account:          Agent #: TABITHA

09-JUL-15 NEW    T    Schonzeit, Gabriel             K     SPG4             59.25  1  0  0  AX   xxxxx1008                xx-xx
14-JUL-15 Group:        CFTID:          Source: WEB  Market Seg: SPG  IATA #1:              AR Account:          Agent #: 9999

12-JUL-15 NEW    T    Chasse, Richard                OQQ   SPG4             59.25  1  0  0  AX   xxxxx1003                xx-xx
17-JUL-15 Group:        CFTID:          Source: NTF  Market Seg: SPG  IATA #1:              AR Account:          Agent #: CRS

12-JUL-15 NEW    T    Chasse, Richard                PK    SPG4             59.25  2  0  0  AX   xxxxx1003                xx-xx
17-JUL-15 Group:        CFTID:          Source: NTF  Market Seg: SPG  IATA #1:              AR Account:          Agent #: CRS

12-JUL-15 NEW    T    Fitzpatrick, Sean              OQQ   SPG4              0.00  1  0  0  AX   xxxxx1003                xx-xx
17-JUL-15 Group:        CFTID:          Source: NTF  Market Seg: SPG  IATA #1:              AR Account:          Agent #: 9999

12-JUL-15 NEW    T    Schott, Brian                  PK    SPG4             59.25  2  0  0  AX   xxxxx1003                xx-xx
17-JUL-15 Group:        CFTID:          Source: WEB  Market Seg: SPG  IATA #1:              AR Account:          Agent #: 9999

20-JUL-15 NEW    T    Goodman, Pamela                K     SPGCPN           75.00  2  0  0  AX   xxxxx1006                xx-xx
22-JUL-15 Group:        CFTID:          Source: WEB  Market Seg: SPG  IATA #1:              AR Account:          Agent #: CRS

26-JUL-15 MOD    G    Leiterman, Michael             OQQ   G225RD          270.00  2  0  0  MC   xxxxx1801                xx-xx
28-JUL-15 Group: ROLNIC CFTID:          Source: SA   Market Seg: WRB  IATA #1:              AR Account:          Agent #: TABITHA
Four Points Eastham                                Reservation Transaction Report                              Page Number:    2
Denise Zevitas                                             For 01-MAR-2015                                 01-MAR-2015 01:28 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

16-AUG-15 NEW    T    Kittner, Rachel                K     SPGCPN           75.00  2  0  0  AX   xxxxx5003                xx-xx
20-AUG-15 Group:        CFTID:          Source: WEB  Market Seg: SPG  IATA #1:              AR Account:          Agent #: CRS

03-SEP-15 MOD    T    Olian, Marsha                  PK    SPGCPN           75.00  1  0  0  AX   xxxxx2001                xx-xx
04-SEP-15 Group:        CFTID: 298940   Source: NTF  Market Seg: SPG  IATA #1:              AR Account:          Agent #: CRS

04-SEP-15 MOD    T    Olian, Marsha                  PK    SPGCPN           75.00  1  0  0  AX   xxxxx2001                xx-xx
06-SEP-15 Group:        CFTID:          Source: WEB  Market Seg: SPG  IATA #1:              AR Account:          Agent #: CRS

05-SEP-15 NEW    T    Arbeter, Eitan                 PDD   BAR             310.00  2  0  0  AX   xxxxx1008                xx-xx
07-SEP-15 Group:        CFTID:          Source: WEB  Market Seg: LEIS IATA #1:              AR Account:          Agent #: 9999


                                                       End of Report

Four Points Eastham                                Reservation Transaction Report                              Page Number:    1
Denise Zevitas                                             For 28-FEB-2015                                 28-FEB-2015 02:34 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

28-FEB-15 CXL    T    Test,                          PDD   DAILY           175.00  2  0  0  CA                            xx-xx
01-MAR-15 Group:        CFTID:          Source: WI   Market Seg: TRES IATA #1:              AR Account:          Agent #: DONNA

02-MAR-15 NEW    T    Leblanc, Allison               K     AUTODEAL         99.00  1  0  0  VI   xxxxx8875                xx-xx
03-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: STARUSER

03-MAR-15 NEW    T    Webster, Susan                 K     AUTODEAL         99.00  1  0  0  VI   xxxxx6196                xx-xx
06-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: STARUSER

06-MAR-15 MOD    G    Shea, Brian                    AK    G149            149.00  1  0  1  VI   xxxxx1279                xx-xx
07-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: TABITHA

07-MAR-15 MOD    T    Ferreira, Ken                  PDD   SPG4             59.25  1  0  2  AX   xxxxx4002                xx-xx
08-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: SPG  IATA #1:              AR Account: 13217    Agent #: STARUSER

21-MAR-15 NEW    T    Childs, Nelli                  K     DAILY21         157.50  2  0  0  AX   xxxxx4005                xx-xx
22-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: CRS

21-MAR-15 NEW    T    Proulx, Erin                   PDD   DAILY21         157.50  1  0  0  MC   xxxxx2826                xx-xx
22-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: CRS

27-MAR-15 MOD    G    Schwarzer-hampton, Mary        OQQ   G119            119.00  1  0  1  VI   xxxxx1036                xx-xx
29-MAR-15 Group: JUMP   CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: CRS

27-MAR-15 MOD    G    Thompson, Megan                OQQ   G119            119.00  2  0  3  VI   xxxxx4328                xx-xx
29-MAR-15 Group: JUMP   CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: TABITHA

03-APR-15 NEW    T    Johnson, Steven                K     BAR             165.00  2  0  0  VI   xxxxx1401                xx-xx
05-APR-15 Group:        CFTID:          Source: NTF  Market Seg: LEIS IATA #1:              AR Account:          Agent #: 9999

10-APR-15 MOD    G    Foley, Janet                   OQQ   G82              82.00  2  0  0  VI   xxxxx0745                xx-xx
12-APR-15 Group: OLD    CFTID:          Source: SA   Market Seg: SOC  IATA #1:              AR Account:          Agent #: TABITHA

19-APR-15 NEW    T    Hausenbauer, Kathleen          PDD   PLINE4           81.00  2  0  0  MC   xxxxx1444                xx-xx
22-APR-15 Group:        CFTID:          Source: 1P   Market Seg: TOP  IATA #1: 7508546      AR Account:          Agent #: 9999

25-APR-15 MOD    G    Pratt, Chris                   OQQ   G119            119.00  2  0  0  VI   xxxxx3595                xx-xx
27-APR-15 Group: XAVIER CFTID:          Source: SA   Market Seg: WRB  IATA #1:              AR Account:          Agent #: TABITHA

14-MAY-15 NEW    T    Hickie, Kimberley              K     BAR             168.33  2  0  0  DI   xxxxx5212                xx-xx
17-MAY-15 Group:        CFTID:          Source: WEB  Market Seg: LEIS IATA #1:              AR Account:          Agent #: 9999

14-MAY-15 NEW    T    Levkoff, George                K     DAILY21         130.50  1  0  0  AX   xxxxx1001                xx-xx
15-MAY-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: 9999

22-MAY-15 NEW    T    Faubert, Renee                 S     BAR             418.33  2  0  0  VI   xxxxx0194                xx-xx
25-MAY-15 Group:        CFTID:          Source: NTF  Market Seg: LEIS IATA #1:              AR Account:          Agent #: 9999

12-JUN-15 NEW    C    Nardone, Michael               PDD   SETGP           250.75  1  0  0  VI   xxxxx3019                xx-xx
14-JUN-15 Group:        CFTID: 77377    Source: WEB  Market Seg: CORP IATA #1:              AR Account:          Agent #: 9999

26-JUN-15 NEW    G    Correale, Dawn                 OQQ   GW239             0.00  1  0  0  AX   xxxxx2005                xx-xx
28-JUN-15 Group: DUGOUT CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: STARUSER
Four Points Eastham                                Reservation Transaction Report                              Page Number:    2
Denise Zevitas                                             For 28-FEB-2015                                 28-FEB-2015 02:34 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

26-JUN-15 MOD    G    Hopkins, Charlene              PDD   GW239           239.00  1  0  1  VI   xxxxx8733                xx-xx
28-JUN-15 Group: DUGOUT CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: TABITHA

28-JUN-15 MOD    G    Nicholson, Christine           PDD   NEEI2           225.00  2  0  0  VI   xxxxx7011                xx-xx
05-JUL-15 Group: NEEI2  CFTID:          Source: NEEI Market Seg: NEEI IATA #1:              AR Account:          Agent #: TABITHA

17-JUL-15 MOD    T    Hoyt Jr, Lawrence              AK    AUTOV           422.75  2  0  0  AX   xxxxx3006                xx-xx
19-JUL-15 Group:        CFTID:          Source: NTF  Market Seg: QD   IATA #1:              AR Account:          Agent #: TABITHA

24-JUL-15 MOD    T    Scanlon, David                 OQQ   SPG4             59.25  1  0  3  VI   xxxxx4350                xx-xx
27-JUL-15 Group:        CFTID: 295936   Source: NTF  Market Seg: SPG  IATA #1:              AR Account: 13217    Agent #: CRS

24-JUL-15 MOD    T    Scanlon, David                 PK    SPG4             59.25  2  0  0  VI   xxxxx4350                xx-xx
27-JUL-15 Group:        CFTID: 295936   Source: NTF  Market Seg: SPG  IATA #1:              AR Account: 13217    Agent #: STARUSER

26-JUL-15 MOD    G    Engel, Michelle                OQQ   NEEI2           270.00  2  0  2  VI   xxxxx2823                xx-xx
31-JUL-15 Group: NEEI6  CFTID:          Source: NEEI Market Seg: NEEI IATA #1:              AR Account:          Agent #: TABITHA

02-AUG-15 NEW    G    Schub, Nancy                   PDD   NEEI2           225.00  2  0  0  VI   xxxxx2570                xx-xx
07-AUG-15 Group: NEEI7  CFTID:          Source: NTF  Market Seg: NEEI IATA #1:              AR Account:          Agent #: 9999

05-SEP-15 NEW    T    Rushton, Kray                  K     DAILY           315.00  2  0  0  AX   xxxxx7006                xx-xx
07-SEP-15 Group:        CFTID:          Source: CI   Market Seg: TRES IATA #1:              AR Account:          Agent #: KRISTAE

12-SEP-15 MOD    T    Fish, Gail                     PDD   BAR             295.00  2  0  0  VI   xxxxx2580                xx-xx
13-SEP-15 Group:        CFTID:          Source: CI   Market Seg: LEIS IATA #1:              AR Account:          Agent #: TABITHA

12-SEP-15 MOD    T    Fish, Gail                     PDD   BAR             295.00  2  0  0  VI   xxxxx2580                xx-xx
13-SEP-15 Group:        CFTID:          Source: CI   Market Seg: LEIS IATA #1:              AR Account:          Agent #: TABITHA

18-SEP-15 MOD    G    Dy-Dorman, Eliza               OQQ   GW179           179.00  2  0  0  VI   xxxxx5144                xx-xx
20-SEP-15 Group: KENNEY CFTID:          Source: SA   Market Seg: WRB  IATA #1:              AR Account:          Agent #: TABITHA


                                                       End of Report

Four Points Eastham                                Reservation Transaction Report                              Page Number:    1
Denise Napolitano                                          For 27-FEB-2015                                 27-FEB-2015 04:47 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

27-FEB-15 CXL    G    Hodgson, Graeme                PDD   G149            149.00  1  0  2  AX   xxxxx2015                xx-xx
01-MAR-15 Group: MITES  CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: KRISTAE

28-FEB-15 NEW    T    Bewley, Gregory                PDD   EXPRM           143.50  1  0  2  CA                            xx-xx
01-MAR-15 Group:        CFTID: 301864   Source: WEB  Market Seg: TRES IATA #1:              AR Account: 11560    Agent #: 9999

28-FEB-15 NEW    T    Bewley, Truman                 PDD   EXPRM           143.50  2  0  0  CA                            xx-xx
01-MAR-15 Group:        CFTID: 301864   Source: WEB  Market Seg: TRES IATA #1:              AR Account: 11560    Agent #: 9999

28-FEB-15 CXL    G    Walbridge, Juliann             PDD   G149            149.00  2  0  3  VI   xxxxx9868                xx-xx
01-MAR-15 Group: MITES  CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

01-MAR-15 NEW    T    Mchatton, Martha               PDD   DAILY10         121.50  2  0  0  VI   xxxxx0027                xx-xx
04-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: 9999

02-MAR-15 NEW    T    Leblanc, Allison               K     AUTODEAL         99.00  1  0  0  VI   xxxxx8875                xx-xx
03-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: CRS

03-MAR-15 NEW    T    Webster, Susan                 K     AUTODEAL         99.00  1  0  0  VI   xxxxx6196                xx-xx
06-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: 9999

05-MAR-15 MOD    G    Arena, Christine               OQQ   G149            149.00  2  0  1  DI   xxxxx4357                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

05-MAR-15 MOD    T    Tramontozzi, Gerald            OQQ   DAILY           149.00  2  0  0  AX   xxxxx1001                xx-xx
06-MAR-15 Group:        CFTID:          Source: CI   Market Seg: TRES IATA #1:              AR Account:          Agent #: DONNA

06-MAR-15 MOD    G    Arabik, Joseph                 OQQ   G149            149.00  2  0  2  DI   xxxxx5243                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Aubertine, Brian               OQQ   G149            149.00  1  0  0  VI   xxxxx1677                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Baldwin, Scott                 AKR   G149            149.00  2  0  0  VI   xxxxx3665                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Batcheleer, Jonathan           OQQ   G149            149.00  2  0  2  AX   xxxxx7004                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bedore, David                  PDD   G149            149.00  2  0  0  VI   xxxxx7496                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bertoncini, Jennifer           OQQ   G149            149.00  2  0  2  MC   xxxxx5787                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Berube, Nicole                 PDD   G149            149.00  2  0  1  VI   xxxxx8981                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bourassa, Debra                PDD   G149            149.00  2  0  1  VI   xxxxx7078                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: LEIS IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bourassa, Debra                PDD   G149            149.00  2  0  1  VI   xxxxx7078                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: LEIS IATA #1:              AR Account:          Agent #: JACQUI
Four Points Eastham                                Reservation Transaction Report                              Page Number:    2
Denise Napolitano                                          For 27-FEB-2015                                 27-FEB-2015 04:47 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

06-MAR-15 MOD    G    Bourque, Paul                  OQQ   G149            149.00  2  0  0  VI   xxxxx4892                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Brown, William                 OQQ   G149            149.00  2  0  2  VI   xxxxx8051                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Browne, Margaret               OQQ   G149            149.00  2  0  1  MC   xxxxx6351                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bunnell, David                 PDD   G149            149.00  2  0  0  MC   xxxxx5028                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: KRISTAE

06-MAR-15 MOD    T    Caplice, Debbie                PDD   FANTASY         160.00  2  0  0  MC   xxxxx4337                xx-xx
08-MAR-15 Group:        CFTID:          Source: CI   Market Seg: PKG  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Capobianco, Kathleen           OQQ   G149            149.00  2  0  2  AX   xxxxx4010                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Carragher, Brian               PDD   G149            149.00  2  0  2  VI   xxxxx2118                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Carter, Doug                   OQQ   G149            149.00  2  0  3  AX   xxxxx6566                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Celtruda, Joe                  OQQ   G149            149.00  2  0  0  VI   xxxxx9323                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Conley, Amy                    PDD   G149            149.00  2  0  2  VI   xxxxx8173                xx-xx
07-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Crawford, Kristin              PDD   G149            149.00  2  0  2  VI   xxxxx6055                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Dagenais, James                OQQ   G149            149.00  2  0  1  AX   xxxxx1017                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Daly, Denise                   OQQ   G149            149.00  1  0  1  VI   xxxxx3275                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Daly, Ivy                      OQQ   G149            149.00  2  0  1  VI   xxxxx8150                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Delaney, Autumn                PDD   EXPAP           129.15  2  0  2  CA                            xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Dorazio, Michael               OQQ   G149            149.00  2  0  1  MC   xxxxx4746                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Ducharme, Kerri                PDD   G149            149.00  2  0  1  VI   xxxxx1731                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Figueire
Four Points Eastham                                Reservation Transaction Report                              Page Number:    1
Denise Napolitano                                          For 27-FEB-2015                                 27-FEB-2015 04:47 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

27-FEB-15 CXL    G    Hodgson, Graeme                PDD   G149            149.00  1  0  2  AX   xxxxx2015                xx-xx
01-MAR-15 Group: MITES  CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: KRISTAE

28-FEB-15 NEW    T    Bewley, Gregory                PDD   EXPRM           143.50  1  0  2  CA                            xx-xx
01-MAR-15 Group:        CFTID: 301864   Source: WEB  Market Seg: TRES IATA #1:              AR Account: 11560    Agent #: 9999

28-FEB-15 NEW    T    Bewley, Truman                 PDD   EXPRM           143.50  2  0  0  CA                            xx-xx
01-MAR-15 Group:        CFTID: 301864   Source: WEB  Market Seg: TRES IATA #1:              AR Account: 11560    Agent #: 9999

28-FEB-15 CXL    G    Walbridge, Juliann             PDD   G149            149.00  2  0  3  VI   xxxxx9868                xx-xx
01-MAR-15 Group: MITES  CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

01-MAR-15 NEW    T    Mchatton, Martha               PDD   DAILY10         121.50  2  0  0  VI   xxxxx0027                xx-xx
04-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: 9999

02-MAR-15 NEW    T    Leblanc, Allison               K     AUTODEAL         99.00  1  0  0  VI   xxxxx8875                xx-xx
03-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: CRS

03-MAR-15 NEW    T    Webster, Susan                 K     AUTODEAL         99.00  1  0  0  VI   xxxxx6196                xx-xx
06-MAR-15 Group:        CFTID:          Source: WEB  Market Seg: QD   IATA #1:              AR Account:          Agent #: 9999

05-MAR-15 MOD    G    Arena, Christine               OQQ   G149            149.00  2  0  1  DI   xxxxx4357                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

05-MAR-15 MOD    T    Tramontozzi, Gerald            OQQ   DAILY           149.00  2  0  0  AX   xxxxx1001                xx-xx
06-MAR-15 Group:        CFTID:          Source: CI   Market Seg: TRES IATA #1:              AR Account:          Agent #: DONNA

06-MAR-15 MOD    G    Arabik, Joseph                 OQQ   G149            149.00  2  0  2  DI   xxxxx5243                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Aubertine, Brian               OQQ   G149            149.00  1  0  0  VI   xxxxx1677                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Baldwin, Scott                 AKR   G149            149.00  2  0  0  VI   xxxxx3665                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Batcheleer, Jonathan           OQQ   G149            149.00  2  0  2  AX   xxxxx7004                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bedore, David                  PDD   G149            149.00  2  0  0  VI   xxxxx7496                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bertoncini, Jennifer           OQQ   G149            149.00  2  0  2  MC   xxxxx5787                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Berube, Nicole                 PDD   G149            149.00  2  0  1  VI   xxxxx8981                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: NTF  Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bourassa, Debra                PDD   G149            149.00  2  0  1  VI   xxxxx7078                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: LEIS IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bourassa, Debra                PDD   G149            149.00  2  0  1  VI   xxxxx7078                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: LEIS IATA #1:              AR Account:          Agent #: JACQUI
Four Points Eastham                                Reservation Transaction Report                              Page Number:    2
Denise Napolitano                                          For 27-FEB-2015                                 27-FEB-2015 04:47 AM
(res.restran)                                    Ordered By Arrive Date, Guest Name

Arrival / ------------Guest Information------------  ------Room Information------ Persons   -----Credit Information-----
Departure Status Type Guest Name                     Rm Tp Rate Sched -Room Rate- AD YO CH  Type Credit Card Number       Exp Date

06-MAR-15 MOD    G    Bourque, Paul                  OQQ   G149            149.00  2  0  0  VI   xxxxx4892                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Brown, William                 OQQ   G149            149.00  2  0  2  VI   xxxxx8051                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Browne, Margaret               OQQ   G149            149.00  2  0  1  MC   xxxxx6351                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Bunnell, David                 PDD   G149            149.00  2  0  0  MC   xxxxx5028                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: KRISTAE

06-MAR-15 MOD    T    Caplice, Debbie                PDD   FANTASY         160.00  2  0  0  MC   xxxxx4337                xx-xx
08-MAR-15 Group:        CFTID:          Source: CI   Market Seg: PKG  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Capobianco, Kathleen           OQQ   G149            149.00  2  0  2  AX   xxxxx4010                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Carragher, Brian               PDD   G149            149.00  2  0  2  VI   xxxxx2118                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Carter, Doug                   OQQ   G149            149.00  2  0  3  AX   xxxxx6566                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Celtruda, Joe                  OQQ   G149            149.00  2  0  0  VI   xxxxx9323                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Conley, Amy                    PDD   G149            149.00  2  0  2  VI   xxxxx8173                xx-xx
07-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Crawford, Kristin              PDD   G149            149.00  2  0  2  VI   xxxxx6055                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Dagenais, James                OQQ   G149            149.00  2  0  1  AX   xxxxx1017                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Daly, Denise                   OQQ   G149            149.00  1  0  1  VI   xxxxx3275                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Daly, Ivy                      OQQ   G149            149.00  2  0  1  VI   xxxxx8150                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Delaney, Autumn                PDD   EXPAP           129.15  2  0  2  CA                            xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: WEB  Market Seg: TRES IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Dorazio, Michael               OQQ   G149            149.00  2  0  1  MC   xxxxx4746                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          Source: SA   Market Seg: SPT  IATA #1:              AR Account:          Agent #: JACQUI

06-MAR-15 MOD    G    Ducharme, Kerri                PDD   G149            149.00  2  0  1  VI   xxxxx1731                xx-xx
08-MAR-15 Group: PEEWEE CFTID:          S
Imports System
Imports System.IO
Imports System.Text

Public Class RestranFileConversion

    Private Sub RestranFileConversion_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        '   Read TextFile for the Properties and insert them into the text boxes

        Call ReadPropertyList()
        Call LabelVisible()
        Call ReadRestranInfoMgr()

    End Sub

    Private Sub btnEditPropList_Click(sender As System.Object, e As System.EventArgs) Handles btnEditPropList.Click
        Call TextBoxVisible()
    End Sub

    Private Sub btnLockPropList_Click(sender As System.Object, e As System.EventArgs) Handles btnLockPropList.Click

        ' This sets the variable to insert into the file and the Property Information will be saved Here.
        blankText = ""

        Dim numArr As New List(Of Integer) 'assuming integers
        'here we add the textbox elements if they are not empty
        For Each txt As Control In Me.Controls
            If txt.GetType Is GetType(TextBox) Then
                If Len(Trim(txt.Text)) Then
                    numArr.Add(CInt(txt.Text)) ' assuming integers
                End If
            End If
        Next
        'here we sort these
        numArr.Sort()

        ' Putting the values of the array back into the individual textboxes
        For itxb = 0 To numArr.Count - 1
            If itxb = 0 Then
                tbxProp1.Text = numArr(itxb)
                testVar1 = numArr(itxb)
            End If
            If itxb = 1 Then
                tbxProp2.Text = numArr(itxb)
                testVar2 = numArr(itxb)
            End If
            If itxb = 2 Then
                tbxProp3.Text = numArr(itxb)
                testVar3 = numArr(itxb)
            End If
            If itxb = 3 Then
                tbxProp4.Text = numArr(itxb)
                testVar4 = numArr(itxb)
            End If
            If itxb = 4 Then
                tbxProp5.Text = numArr(itxb)
                testVar5 = numArr(itxb)
            End If
            If itxb = 5 Then
                tbxProp6.Text = numArr(itxb)
                testVar6 = numArr(itxb)
            End If
            If itxb = 6 Then
                tbxProp7.Text = numArr(itxb)
                testVar7 = numArr(itxb)
            End If
            If itxb = 7 Then
                tbxProp8.Text = numArr(itxb)
                testVar8 = numArr(itxb)
            End If
            If itxb = 8 Then
                tbxProp9.Text = numArr(itxb)
                testVar9 = numArr(itxb)
            End If
            If itxb = 9 Then
                tbxProp10.Text = numArr(itxb)
                testVar10 = numArr(itxb)
            End If
            If itxb = 10 Then
                tbxProp11.Text = numArr(itxb)
                testVar11 = numArr(itxb)
            End If
            If itxb = 11 Then
                tbxProp12.Text = numArr(itxb)
                testVar12 = numArr(itxb)
            End If
            If itxb = 12 Then
                tbxProp13.Text = numArr(itxb)
                testVar13 = numArr(itxb)
            End If
            If itxb = 13 Then
                tbxProp14.Text = numArr(itxb)
                testVar14 = numArr(itxb)
            End If
            If itxb = 14 Then
                tbxProp15.Text = numArr(itxb)
                testVar15 = numArr(itxb)
            End If
            If itxb = 15 Then
                tbxProp16.Text = numArr(itxb)
                testVar16 = numArr(itxb)
            End If
            If itxb = 16 Then
                tbxProp17.Text = numArr(itxb)
                testVar17 = numArr(itxb)
            End If
            If itxb = 17 Then
                tbxProp18.Text = numArr(itxb)
                testVar18 = numArr(itxb)
            End If
            If itxb = 18 Then
                tbxProp19.Text = numArr(itxb)
                testVar19 = numArr(itxb)
            End If
            If itxb = 19 Then
                tbxProp20.Text = numArr(itxb)
                testVar20 = numArr(itxb)
            End If
        Next

        FILE_NAME = "C:\Restran Conversion\RestranFileConversion.txt"
        My.Computer.FileSystem.WriteAllText(FILE_NAME, blankText, False)

        If System.IO.File.Exists(FILE_NAME) = True Then
            Dim objWriter As New System.IO.StreamWriter(FILE_NAME, False)
            If IsNumeric(tbxProp1.Text) = True Then
                objWriter.WriteLine(tbxProp1.Text)
            End If
            If IsNumeric(tbxProp2.Text) = True Then
                objWriter.WriteLine(tbxProp2.Text)
            End If
            If IsNumeric(tbxProp3.Text) = True Then
                objWriter.WriteLine(tbxProp3.Text)
            End If
            If IsNumeric(tbxProp4.Text) = True Then
                objWriter.WriteLine(tbxProp4.Text)
            End If
            If IsNumeric(tbxProp5.Text) = True Then
                objWriter.WriteLine(tbxProp5.Text)
            End If
            If IsNumeric(tbxProp6.Text) = True Then
                objWriter.WriteLine(tbxProp6.Text)
            End If
            If IsNumeric(tbxProp7.Text) = True Then
                objWriter.WriteLine(tbxProp7.Text)
            End If
            If IsNumeric(tbxProp8.Text) = True Then
                objWriter.WriteLine(tbxProp8.Text)
            End If
            If IsNumeric(tbxProp9.Text) = True Then
                objWriter.WriteLine(tbxProp9.Text)
            End If
            If IsNumeric(tbxProp10.Text) = True Then
                objWriter.WriteLine(tbxProp10.Text)
            End If
            If IsNumeric(tbxProp11.Text) = True Then
                objWriter.WriteLine(tbxProp11.Text)
            End If
            If IsNumeric(tbxProp12.Text) = True Then
                objWriter.WriteLine(tbxProp12.Text)
            End If
            If IsNumeric(tbxProp13.Text) = True Then
                objWriter.WriteLine(tbxProp13.Text)
            End If
            If IsNumeric(tbxProp14.Text) = True Then
                objWriter.WriteLine(tbxProp14.Text)
            End If
            If IsNumeric(tbxProp15.Text) = True Then
                objWriter.WriteLine(tbxProp15.Text)
            End If
            If IsNumeric(tbxProp16.Text) = True Then
                objWriter.WriteLine(tbxProp16.Text)
            End If
            If IsNumeric(tbxProp17.Text) = True Then
                objWriter.WriteLine(tbxProp17.Text)
            End If
            If IsNumeric(tbxProp18.Text) = True Then
                objWriter.WriteLine(tbxProp18.Text)
            End If
            If IsNumeric(tbxProp19.Text) = True Then
                objWriter.WriteLine(tbxProp19.Text)
            End If
            If IsNumeric(tbxProp20.Text) = True Then
                objWriter.WriteLine(tbxProp20.Text)
            End If
            objWriter.Close()
        End If
        Call ReadPropertyList()
        Call LabelVisible()

    End Sub

    Private Sub LabelVisible()        
        tbxProp1.Visible = False
        tbxProp2.Visible = False
        tbxProp3.Visible = False
        tbxProp4.Visible = False
        tbxProp5.Visible = False
        tbxProp6.Visible = False
        tbxProp7.Visible = False
        tbxProp8.Visible = False
        tbxProp9.Visible = False
        tbxProp10.Visible = False
        tbxProp11.Visible = False
        tbxProp12.Visible = False
        tbxProp13.Visible = False
        tbxProp14.Visible = False
        tbxProp15.Visible = False
        tbxProp16.Visible = False
        tbxProp17.Visible = False
        tbxProp18.Visible = False
        tbxProp19.Visible = False
        tbxProp20.Visible = False
        lblProp1.Visible = True
        lblProp2.Visible = True
        lblProp3.Visible = True
        lblProp4.Visible = True
        lblProp5.Visible = True
        lblProp6.Visible = True
        lblProp7.Visible = True
        lblProp8.Visible = True
        lblProp9.Visible = True
        lblProp10.Visible = True
        lblProp11.Visible = True
        lblProp12.Visible = True
        lblProp13.Visible = True
        lblProp14.Visible = True
        lblProp15.Visible = True
        lblProp16.Visible = True
        lblProp17.Visible = True
        lblProp18.Visible = True
        lblProp19.Visible = True
        lblProp20.Visible = True
        btnEditPropList.Visible = True
        btnLockPropList.Visible = False
        btnClearAllProp.Visible = False
    End Sub

    Private Sub TextBoxVisible()
        lblProp1.Visible = False
        lblProp2.Visible = False
        lblProp3.Visible = False
        lblProp4.Visible = False
        lblProp5.Visible = False
        lblProp6.Visible = False
        lblProp7.Visible = False
        lblProp8.Visible = False
        lblProp9.Visible = False
        lblProp10.Visible = False
        lblProp11.Visible = False
        lblProp12.Visible = False
        lblProp13.Visible = False
        lblProp14.Visible = False
        lblProp15.Visible = False
        lblProp16.Visible = False
        lblProp17.Visible = False
        lblProp18.Visible = False
        lblProp19.Visible = False
        lblProp20.Visible = False
        tbxProp1.Visible = True
        tbxProp2.Visible = True
        tbxProp3.Visible = True
        tbxProp4.Visible = True
        tbxProp5.Visible = True
        tbxProp6.Visible = True
        tbxProp7.Visible = True
        tbxProp8.Visible = True
        tbxProp9.Visible = True
        tbxProp10.Visible = True
        tbxProp11.Visible = True
        tbxProp12.Visible = True
        tbxProp13.Visible = True
        tbxProp14.Visible = True
        tbxProp15.Visible = True
        tbxProp16.Visible = True
        tbxProp17.Visible = True
        tbxProp18.Visible = True
        tbxProp19.Visible = True
        tbxProp20.Visible = True
        btnEditPropList.Visible = False
        btnLockPropList.Visible = True
        btnClearAllProp.Visible = True
    End Sub

    Private Sub ReadPropertyList()
        tbxProp1.Text =

I can't run this locally because you supplied only the code that runs the form. I am not going to create all the controls manually and guess as to their placement or grouping. Please zip the project folder and post it.

The simplest code to just merge the files would be

Dim filelist() As String = {"d:\temp\don\20150228.txt", "d:\temp\don\20150301.txt", "d:\temp\don\20150302.txt"}

Dim sw As New System.IO.StreamWriter("d:\temp\don\out.txt", False)

For Each file As String In filelist

    Dim lines() As String = System.IO.File.ReadAllLines(file)

    For i = 0 To UBound(lines) - 4
        sw.WriteLine(lines(i))
    Next

Next

sw.WriteLine("")
sw.WriteLine("")
sw.WriteLine("                                                       End of Report")
sw.Close()

Note that I just dummied in three files. If you create a list of file names by scanning the folder and use the same loop then it should work no matter how many files are in the list.

Comments
Pro speaking here!

Please turn "Option Explicit" on in your VS. It's not a good idea to use variables without declaring them.

In VS 2008/2010:
Click "Tools" in menu bar
Select "Options"
Double-click "Projects and Solutions" to expand it
Click "VB Defaults"
Change "Option Explicit" to "On"
Click "OK"

Also, in looking through your code, it appears that some of your code has gotten out of hand. It isn't apparent what the purpose of "RestranInformationManager.txt" and "RestranFileConversion.txt" are, nor did you include them. It seems that perhaps it is providing information that can be extracted by reading directory contents (ie: folder names and/or filenames)--according to some of your other posts.

What are the 20 textboxes and 20 labels for?
Labels:
-lblProp1
-lblProp2
...
-lblProp20

TextBoxes:
-tbxProp1
-tbxProp2
...
-tbxProp20

It looks like you are using 7 buttons--some of which seem might be better as options in a MenuStrip.

Buttons:
-btnEditPropList
-btnLockPropList
-btnClearAllProp
-btnPropEditor
-btnConvertFiles
-btnInfoMgr
-btnExitSub

Edited 1 Year Ago by cgeier

It appears that you may be using the wrong encoding when reading and writing the files.

File.ReadAllText Method (String)
...This method attempts to automatically detect the encoding of a file based on the presence of byte order marks...

Byte order mark
...The UTF-8 representation of the BOM is the byte sequence 0xEF, 0xBB, 0xBF...

The following post: What are the differences between Linux and Windows .txt files (Unicode encoding) references some tools that can be used to determine file encoding. I used File for Windows on the original text file you posted (20150228.txt), and it showed "ASCII text". I also used "xxd" (a Cygwin download) which showed the following: 466f757220506f696e747320...

More easily read: 46 6f 75 72 20 50 6f 69 6e 74 73 20...

If you look these (hex codes) up in an ASCII table, you'll see the following:
46=F
6f=o
75=u
72=r
20=space
50=P
6f=o
69=i
6e=n
74=t
73=s
20=space

Note: As you can see, the original file (20150228.txt) doesn't contain a byte order mark.

When I used I used File for Windows on the "converted" (786Restran.txt) file you posted , it showed "UTF-8 Unicode (with BOM) text, with CRLF line terminators". I also used "xxd" (a Cygwin download) which showed the following: efbbbf466f757220506f696e747320...

More easily read: ef bb bf 46 6f 75 72 20 50 6f 69 6e 74 73 20...

As referenced above, "ef bb bf" (efbbbf) is the byte order mark for UTF-8, which is basically pre-pended to what was in the original file--46 6f 75...is how the original file (20150228.txt) begins.

So, it appears that you should be specifying the file encoding when reading/writing these files. Use the following File.ReadAllText Method (String, Encoding) instead -- where Encoding = Encoding.ASCII

LikeWise, File.ReadLines Method (String, Encoding) -- where Encoding = Encoding.ASCII.

FileSystem.ReadAllText Method (String, Encoding) -- where Encoding = Encoding.ASCII

File.WriteAllText Method (String, String, Encoding) -- where Encoding = Encoding.ASCII

FileSystem.WriteAllText Method (String, String, Boolean, Encoding) -- where Encoding = Encoding.ASCII

...Encoding...Default is UTF-8...

Therefore, if encoding isn't specified, it's defaulting to UTF-8.

Note: An easier way to see if the encoding is UTF-8, is to open the file in Notepad. Then in the menu bar, click "File. Select "Save As". To the left of the "Save" button you'll see "Encoding". If it says "ANSI", then the encoding is "ASCII". If it says, "UTF-8", then the file encoding is UTF-8. Now, click "Cancel".

Edited 1 Year Ago by cgeier

After reading through some of your posts, I have some suggestions:

Rather than doing this:

        Dim propertyNo As String = "1540"
        Dim propertyNo1 As String = String.Empty
        Dim strLength As Integer = propertyNo.Length

        If strLength = 2 Then
            propertyNo1 = "000" & propertyNo
        End If
        If strLength = 3 Then
            propertyNo1 = "00" & propertyNo
        End If
        If strLength = 4 Then
            propertyNo1 = "0" & propertyNo
        End If
        If strLength = 5 Then
            propertyNo1 = propertyNo
        End If

You can do this:

        Dim propertyNo As String = "1540"
        Dim propertyNo1 As String = String.Empty

        'convert property number to 5 digits
        If IsNumeric(propertyNumber) Then
            'convert propertyNumber to an integer 
            'so it can be converted
            'to a 5-digit string using "ToString"
            propertyNo1 = Convert.ToInt32(propertyNumber).ToString("D5")
        End If

Also, the following code should be all that you need to "merge" your files. Unfortunately, there were some things that I was unable to determine, based on the information that you've provided so far--such as the directory name / filename structure. This would be necessary to determine which parts can be automated and which parts require user input. I was also unable to determine if you want the user to be able to decide which files to merge or which properties to merge. Additionally, I was uncertain if a merged file should only contain information for that particular property, or if more than one property can be part of a single (merged) file.

MergeFile:

Private Sub MergeFile(ByVal inputFilename As String, ByVal inputFileEncoding As Encoding, ByVal outputFilename As String, ByVal outputFileEncoding As Encoding, ByVal addFormFeedToFirstPage As Boolean, ByVal removeEndOfReport As Boolean)
    'read input file data into a string array
    Dim fileDataArr() As String = File.ReadAllLines(inputFilename, inputFileEncoding)

    'add form feed to first page of all files 
    'except the first one;
    'addFormFeedToFirstPage should be set to 
    'True for all files except the first one
    If addFormFeedToFirstPage Then
        'Chr(12) is ASCII code 0C or 12
        fileDataArr(0) = Chr(12) & fileDataArr(0)
    End If

    'if necessary, remove lines at end of report - 
    '"End of Report" and some blank lines
    If removeEndOfReport Then
        ReDim Preserve fileDataArr(fileDataArr.Length - 4)
    End If

    'add Newline (carriage return) to each line
    Dim outputDataStr As String = Join(fileDataArr, System.Environment.NewLine)

    'append data to output file
    File.AppendAllText(outputFilename, outputDataStr, outputFileEncoding)

End Sub

MergeRestranFiles:

Public Sub MergeRestranFiles(ByVal filenameList As List(Of String), ByVal inputFileEncoding As Encoding, ByVal outputFilename As String, ByVal outputFileEncoding As Encoding)
    Dim addFormFeedToFirstPage = False

    'delete previous output file
    If System.IO.File.Exists(outputFilename) Then
        System.IO.File.Delete(outputFilename)
    End If

    'use loop to merge files
    For i As Integer = 0 To filenameList.Count - 1

        'when merging files, add Form Feed (0C) 
        'to beginning of all files except the 
        'first one
        If i = 0 Then
            addFormFeedToFirstPage = False
        Else
            addFormFeedToFirstPage = True
        End If

        'merge files
        If i < filenameList.Count - 1 Then
            'merge file and remove "End Of Report" /
            'extra blank lines
            MergeFile(filenameList(i), inputFileEncoding, outputFilename, outputFileEncoding, addFormFeedToFirstPage, True)
        Else
            'merge file and keep "End of Report" / 
            'extra blank lines
            MergeFile(filenameList(i), inputFileEncoding, outputFilename, outputFileEncoding, addFormFeedToFirstPage, False)
        End If
    Next

    Debug.WriteLine("Saved to: " & outputFilename)
End Sub

Usage:

Dim filenameList As New List(Of String)

filenameList.Add("C:\Restran Conversion\1540\20150228.txt")
filenameList.Add("C:\Restran Conversion\1540\20150301.txt")
filenameList.Add("C:\Restran Conversion\1540\20150302.txt")

'merge files in filenameList
MergeRestranFiles(filenameList, Encoding.ASCII, outputFilename, Encoding.ASCII)

See my post in Character Identification regarding the symbol that can be seen at the beginning of some of the lines (that contain "Page Number:") when viewing your original files (ex: "20150228.txt") in Notepad.

Sub code is attached.

Edited 1 Year Ago by cgeier

I made some modifications to the code above, made "inputFileEncoding" and "outputFileEncoding" properties instead of parameters, added error handling/logging capabilities, and added more documentation.

Need the following imports:
Imports System.IO
Imports System.Text

Add the following to the module:

Public Property InputFileEncoding As Encoding = Encoding.ASCII
Public Property OutputFileEncoding As Encoding = Encoding.ASCII

Public Property LogFilename As String = "RestranLog.txt"

'holds last error message
Private _errMsg As String = String.Empty

'StreamWriter for log file
Private _swLogFile As StreamWriter = Nothing

Private _outputFilename As String = String.Empty

MergeFile:

Private Sub MergeFile(ByVal inputFilename As String, ByVal outputFilename As String, ByVal addFormFeedToFirstPage As Boolean, ByVal removeEndOfReport As Boolean)
    Dim fileDataArr() As String = Nothing
    Dim logMsg As String = String.Empty

    Try
        'read input file data into a string array
        fileDataArr = File.ReadAllLines(inputFilename, InputFileEncoding)

        'add form feed to first page of all files 
        'except the first one addFormFeedToFirstPage 
        'should be set to True for all files except
        'the first one
        If addFormFeedToFirstPage Then
            'Chr(12) is ASCII code 0C or 12
            fileDataArr(0) = Chr(12) & fileDataArr(0)
        End If

        'if necessary, remove lines at end of report - 
        '"End of Report" and some blank lines
        If removeEndOfReport Then
            'resize array removing last 4 elements (lines)
            ReDim Preserve fileDataArr(fileDataArr.Length - 4)
        End If

        'add Newline (carriage return) to each line
        Dim outputDataStr As String = Join(fileDataArr, System.Environment.NewLine)

        'append data to output file
        File.AppendAllText(outputFilename, outputDataStr, OutputFileEncoding)

        'make log file entry
        logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " File: " & inputFilename & " merged to: " & outputFilename
        _swLogFile.WriteLine(logMsg)

    Catch ex As Exception
        _errMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Error: MergeFile(1) -- " & "Input file: '" & inputFilename & "' Output file: '" & outputFilename & "' ErrMsg: " & ex.Message

        'make log file entry
        _swLogFile.WriteLine(_errMsg)
        Debug.WriteLine(_errMsg)
    End Try
End Sub

MergeRestranFiles:

Public Sub MergeRestranFiles(ByVal inputFilenameList As List(Of String), ByVal outputFilename As String)
    Dim addFormFeedToFirstPage As Boolean = False
    Dim outputFileDir As String = String.Empty
    Dim logMsg As String = String.Empty

    Try
        're-intialize
        _errMsg = String.Empty

        'open StreamWriter to log file (for appending)
        _swLogFile = New StreamWriter(LogFilename, True)

        'get directory name
        outputFileDir = Path.GetDirectoryName(outputFilename)

        'delete previous output file
        If File.Exists(outputFilename) Then
            File.Delete(outputFilename)
        End If

        'create outputFileDir if it doesn't exist
        If Not Directory.Exists(outputFileDir) Then
            Directory.CreateDirectory(outputFileDir)
        End If

        'use loop to merge files
        For i As Integer = 0 To inputFilenameList.Count - 1

            'when merging files, add Form Feed (0C) to 
            'beginning of all files except the first one
            If i = 0 Then
                addFormFeedToFirstPage = False
            Else
                addFormFeedToFirstPage = True
            End If

            'merge files
            If i < inputFilenameList.Count - 1 Then
                'merge file and remove "End Of Report" /
                'extra blank lines
                MergeFile(inputFilenameList(i), outputFilename, addFormFeedToFirstPage, True)
            Else
                'merge file and keep "End of Report" / 
                'extra blank lines
                MergeFile(inputFilenameList(i), outputFilename, addFormFeedToFirstPage, False)
            End If
        Next

        If String.IsNullOrEmpty(_errMsg) Then
            logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Info: Operation completed successfully."
        Else
            logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Error: Operation failed."
        End If

        'make log file entry
        _swLogFile.WriteLine(logMsg)

        Debug.WriteLine(logMsg)
    Catch ex As Exception
        _errMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Error: MergeRestranFiles -- " & ex.Message

        'make log file entry
        _swLogFile.WriteLine(_errMsg)
        Debug.WriteLine(_errMsg)

    Finally

        'close log file StreamWriter
        If Not _swLogFile Is Nothing Then
            _swLogFile.Close()
        End If
    End Try
End Sub

Usage:

Dim inputFilenameList As New List(Of String)
Dim propertyNumber As String = String.Empty
Dim outputFilename As String = "C:\Restran Conversion\1540\RestranConverted.txt"

inputFilenameList.Add("C:\Restran Conversion\1540\20150228.txt")
inputFilenameList.Add("C:\Restran Conversion\1540\20150301.txt")
inputFilenameList.Add("C:\Restran Conversion\1540\20150302.txt")

MergeRestranFiles(inputFilenameList, outputFilename)
'MergeRestranFilesA(inputFilenameList, outputFilename)

Here is an alternate version of "MergeFile and "MergeRestranFiles"--they leave a StreamWriter open to the output file until all writing is complete (eliminating multiple opening/closing of the same output file).

MergeFile:

Private Sub MergeFile(ByVal inputFilename As String, ByVal swOutputFile As StreamWriter, ByVal addFormFeedToFirstPage As Boolean, ByVal removeEndOfReport As Boolean)
    Dim fileDataArr() As String = Nothing
    Dim logMsg As String = String.Empty

    Try
        'read input file data into a string array
        fileDataArr = File.ReadAllLines(inputFilename, InputFileEncoding)

        'add form feed to first page of all files 
        'except the first one addFormFeedToFirstPage 
        'should be set to True for all files except
        'the first one
        If addFormFeedToFirstPage Then
            'Chr(12) is ASCII code 0C or 12
            fileDataArr(0) = Chr(12) & fileDataArr(0)
        End If

        'if necessary, remove lines at end of report - 
        '"End of Report" and some blank lines
        If removeEndOfReport Then
            'resize array removing last 4 elements (lines)
            ReDim Preserve fileDataArr(fileDataArr.Length - 4)
        End If

        'add Newline (carriage return) to each line
        Dim outputDataStr As String = Join(fileDataArr, System.Environment.NewLine)

        'append data to output file
        swOutputFile.WriteLine(outputDataStr)

        'make log file entry
        logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " File: " & inputFilename & " merged to: " & _outputFilename
        _swLogFile.WriteLine(logMsg)

    Catch ex As Exception
        _errMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Error: MergeFile(2) -- " & "Input file: '" & inputFilename & "' Output file: '" & _outputFilename & "' ErrMsg: " & ex.Message

        'make log file entry
        _swLogFile.WriteLine(_errMsg)
        Debug.WriteLine(_errMsg)
    End Try

End Sub

I've named this verion of "MergeRestranFiles" "MergeRestranFilesA".

MergeRestranFilesA:

Public Sub MergeRestranFilesA(ByVal inputFilenameList As List(Of String), ByVal outputFilename As String)
    Dim addFormFeedToFirstPage As Boolean = False
    Dim outputFileDir As String = String.Empty
    Dim swOutputFile As StreamWriter = Nothing
    Dim logMsg As String = String.Empty

    Try
        're-intialize
        _errMsg = String.Empty

        'open StreamWriter to log file (for appending)
        _swLogFile = New StreamWriter(LogFilename, True)

        'get directory name
        outputFileDir = Path.GetDirectoryName(outputFilename)

        'delete previous output file
        If File.Exists(outputFilename) Then
            File.Delete(outputFilename)
        End If

        'create outputFileDir if it doesn't exist
        If Not Directory.Exists(outputFileDir) Then
            Directory.CreateDirectory(outputFileDir)
        End If

        'set _outputFilename; needed for MergeFile
        _outputFilename = outputFilename

        'open StreamWriter to output file (for appending)
        swOutputFile = New StreamWriter(outputFilename, True)

        'use loop to merge files
        For i As Integer = 0 To inputFilenameList.Count - 1

            'when merging files, add Form Feed (0C) to 
            'beginning of all files except the first one
            If i = 0 Then
                addFormFeedToFirstPage = False
            Else
                addFormFeedToFirstPage = True
            End If

            'merge files
            If i < inputFilenameList.Count - 1 Then
                'merge file and remove "End Of Report" /
                'extra blank lines
                MergeFile(inputFilenameList(i), swOutputFile, addFormFeedToFirstPage, True)
            Else
                'merge file and keep "End of Report" / 
                'extra blank lines
                MergeFile(inputFilenameList(i), swOutputFile, addFormFeedToFirstPage, False)
            End If
        Next

        If String.IsNullOrEmpty(_errMsg) Then
            logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Info: Operation completed successfully."
        Else
            logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Error: Operation failed."
        End If

        'make log file entry
        _swLogFile.WriteLine(logMsg)

        Debug.WriteLine(logMsg)
    Catch ex As Exception
        _errMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " Error: MergeRestranFilesA -- " & ex.Message

        'make log file entry
        _swLogFile.WriteLine(_errMsg)
        Debug.WriteLine(_errMsg)

    Finally
        'close output file StreamWriter
        If Not swOutputFile Is Nothing Then
            swOutputFile.Close()
        End If

        'close log file StreamWriter
        If Not _swLogFile Is Nothing Then
            _swLogFile.Close()
        End If
    End Try
End Sub

Usage for "MergeRestranFilesA" is the same as "MergeRestranFiles".

Sub code attached below.

Edited 1 Year Ago by cgeier

@Don: Your code is too some lengthy and it is not possible to create a project for testing your codes and fide the causes of exceptions.
But I just tried to modify your codes for File Conversion. The codes are

    Private Sub btnConvertFiles_Click(sender As System.Object, e As System.EventArgs) Handles btnConvertFiles.Click
        Me.Text = "Restran File Conversion (Running)"

        Dim getRestranName() As String

        ' setting the path to find the file to convert
        '   Reading for File information
        infoManager = "C:\Restran Conversion\RestranInformationManager.txt"
        FILE_NAME = "C:\Restran Conversion\RestranFileConversion.txt"
        Dim i As Integer = 1

        If System.IO.File.Exists(infoManager) = True Then
            Dim objReader As New System.IO.StreamReader(infoManager)
            Do While objReader.Peek() <> -1
                lineRead = objReader.ReadLine()
                If i = 1 Then
                    filePath = lineRead
                End If
                If i = 2 Then
                    filePrefix = lineRead
                End If
                If i = 3 Then
                    fileSuffix = lineRead
                End If
                If i = 4 Then
                    ResListPath = lineRead
                End If
                i = i + 1
            Loop
            objReader.Close()
        Else
            Select Case MessageBox.Show("The Information Manager,  failed to connect" & "Do you want to continue?", "File Error", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
                Case Windows.Forms.DialogResult.No
                    Exit Sub
            End Select
        End If

        Dim pageCode As Char = Microsoft.VisualBasic.ChrW(&H2640)

        Me.Cursor = Cursors.WaitCursor

        Dim propertyCount As Integer = File.ReadAllLines(FILE_NAME).Length
        ' Begin Updating and converting the multiple properties.
        propNo = 1
        Do While propNo > propertyCount
            For Each crtl As Control In Me.Controls
                If (crtl.Name = "tbxProp" & propNo) Then
                    propertyNo = crtl.Text
                    Exit For
                End If
            Next

            If propertyNo.Length < 5 Then
                propertyNo1 = CStr(Format(Val(propertyNo), "00000"))
                propertyNo2 = CStr(Format(Val(propertyNo), "0000"))
            Else
                propertyNo1 = propertyNo
                propertyNo2 = propertyNo
            End If

            folderName = filePath & "\" & filePrefix & propertyNo1 & fileSuffix
            If Not System.IO.Directory.Exists(folderName) Then
                Select Case MessageBox.Show("The folder selected" & Environment.NewLine & "'" & folderName & "'" & Environment.NewLine & " does not exist. To continue, click 'Yes'.", "Folder Error", MessageBoxButtons.YesNo)
                    Case Windows.Forms.DialogResult.No
                        Select Case MessageBox.Show("Reset the 'Property List'?", "Folder Error", MessageBoxButtons.YesNo)
                            Case Windows.Forms.DialogResult.Yes
                                Call TextBoxVisible()
                                Exit Do
                        End Select
                End Select
            Else
                getRestranName = System.IO.Directory.GetFiles(folderName)
                fileCount = My.Computer.FileSystem.GetFiles(folderName).Count
                If fileCount = 0 Then
                    MessageBox.Show("'" & folderName & "' does not contain a RESTRAN to be converted.", "Property #" & propertyNo, MessageBoxButtons.OK)
                    Continue Do
                End If
                If fileCount > 1 Then

                    For x As Integer = getRestranName.GetLowerBound(0) To getRestranName.GetUpperBound(0)
                        If fileCount > 1 Then
                            Dim readtxt() As String = System.IO.File.ReadAllLines(getRestranName(x))
                            File.Delete(getRestranName(x))

                            For y As Integer = readtxt.GetLowerBound(0) To readtxt.GetUpperBound(0) - 4
                                My.Computer.FileSystem.WriteAllText(getRestranName(0), readtxt(y), True)
                                If y < readtxt.GetUpperBound(0) - 4 Then
                                    'Appending a new line into the text file.
                                    My.Computer.FileSystem.WriteAllText(getRestranName(0), vbCrLf, True)
                                End If
                            Next
                            If x < fileCount - 1 Then
                                'Appending the spacial charactor and feed a new line
                                My.Computer.FileSystem.WriteAllText(getRestranName(0), vbCrLf & pageCode, True)
                            End If
                        End If
                    Next

                End If

                ' This finds the folder to where to drop the saved restran file

                Using reader As New StreamReader("O:\IPSDATA\Property Folder Names.txt")
                    While Not reader.EndOfStream
                        Dim line As String = reader.ReadLine()
                        If line.Contains(propertyNo2) Then
                            hotelFolder = line
                            Exit While
                        End If
                    End While
                End Using

                ' setting the path name to save the converted file
                fileSave = "O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels\" & hotelFolder & "\Restran\" & propertyNo & "Restran.txt"
                ' Getting date extension to save the file in a history 

                Dim yesterday As Date
                Dim day As String = ""
                Dim month As String = ""
                Dim year As String
                Dim copyfile As String
                Dim txtline As String

                yesterday = DateAdd(DateInterval.Day, -1, Today.Date)
                day = CStr(Format(yesterday.Day, "00"))
                month = CStr(Format(yesterday.Month, "00"))
                year = yesterday.Year.ToString
                year = year.Substring(2, 2)
                copyfile = "O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels\" & hotelFolder & "\Restran\Restran History\" & propertyNo & " Restran " & month & day & year & ".txt"
                ' This reads the text file for conversion
                txtline = My.Computer.FileSystem.ReadAllText(getRestranName(0))
                ' This begins to add the carriage returns in the appropriate places
                txtline = Replace(txtline, vbLf, vbCrLf)
                txtline = Replace(txtline, vbCr & vbCr, vbCr)
                txtline = Replace(txtline, """", "")
                ' This writes the line to the file
                My.Computer.FileSystem.WriteAllText(fileSave, txtline, False)
                System.IO.File.Copy(fileSave, copyfile)
                ' This deletes the old unconverted file
                System.IO.File.Delete(getRestranName(0))
            End If
            propNo += 1
        Loop

        'Next propNo
        Me.Cursor = Cursors.Default
        Dim result3 As DialogResult = MessageBox.Show("File conversion has completed.", "Conversion Complete", MessageBoxButtons.OK)
        Me.Text = "Restran File Conversion"
    End Sub

Hope it can help you.

This question has already been answered. Start a new discussion instead.