Hack Forums
[.NET] Need to get one line each time the function is called, and each time it's called.... - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Need to get one line each time the function is called, and each time it's called.... (/showthread.php?tid=5446561)



Need to get one line each time the function is called, and each time it's called.... - Pharmacist - Oct 28, 2016

I need to get one line at a time from a TextBox, and each time the function is called, it goes to the next line in the list of string in the TextBox.

Anyone help out with this?


* - DopplerAF - Oct 28, 2016

Here you go maybe this will help you
Code
Dim index as Integer = 0
Public Function ReadNextLine() As String
Return TextBox1.Lines(index).ToString
index += 1
End Function



* - Pharmacist - Oct 28, 2016

(Oct 28, 2016 04:23 AM)shazsyed Wrote:  Here you go maybe this will help you
Code
Dim index as Integer = 0
Public Function ReadNextLine() As String
Return TextBox1.Lines(index).ToString
index += 1
End Function

I'm about to test it out.
If it works, I need your address to come kiss your ass.

edit:
Doesn't work, only gets the first line.


* - DopplerAF - Oct 28, 2016

My mistake.. I called the return without ever adding the index. Here it is fixed now.

Code
Dim index as Integer = 0

Public Function GetTextLineByLine() As String
Dim result = TextBox1.Lines(index).ToString
index = index + 1
Return result
End Function



* - Pharmacist - Oct 28, 2016

Thanks for those who tried to help! I had a friend who fixed it in like 5 seconds over TeamViewer.. I've been working on this all night long.