I'm taking a text file that is storing ID numbers in a single column that looks like this:
I'm looping through the text file line for line and putting each ID number into a textbox. My question is: Am I writing this code the most efficient way? Here's my code:
Dim FILE_NAME As String = "C:\Restran Conversion\RestranFileConversion.txt" Dim objReader As New System.IO.StreamReader(FILE_NAME) Dim txtProps As String Dim i As Integer = 1 If System.IO.File.Exists(FILE_NAME) = True Then Do While objReader.Peek() <> -1 txtProps = objReader.ReadLine() If i = 1 Then prop1 = txtProps End If If i = 2 Then prop2 = txtProps End If If i = 3 Then prop3 = txtProps End If i = i + 1 Loop tbxProp1.Text = prop1 tbxProp2.Text = prop2 tbxProp3.Text = prop3
I'm thinking there is a programtically more efficient way to write this. If you have some thoughts, please do share!
As always, thanks for your responses.