Hi,
VB.NET 2019
I am trying to load a comma delimited .csv file on disk into a string array. I have found the code below which works OK but the problem is that I want to be able to access the array from any part of the program which does not work. I am guessing that I need to declare the variable vArray as a Public (or whatever) variable at the top of the form code window but the code below uses Dim vArray which does not allow this. How can I change the code to copy the data into the array without using the Dim statement?
Function FetchNewWord() As String
'Fetch new word from list of words
Dim vFilename As String
vFilename = "C:\VSI 2019\My Game\Words4.csv"
Dim vArray As String() = System.IO.File.ReadAllLines(vFilename)
Return vArray(1)
End Function
Peter Hibbs.