Am new to this and was wondering if anyone knew a solution to this problem.
I am wanting to get information from a text file into different arrays.
My current text file has a new line for each driver but I would like it to look something like this:
Each line of the text file represents a player and each player has 6 drivers.
Each driver is seperated by a comma (,) which is what I need the program to understand.
So for example I would want to import 'player one' drivers into the array:
playerdrivers(1,1) - playerdrivers(1,6)
So (1,1) would be Hamilton (1,2) would be Button and so on.
Player two and further players would have a different first number e.g (2,1) (3,1)
This code I have written but does not work as it tries to convert from string to double.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim playerdrivers(4, 6) As Array Dim destination As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/f1data/bin/array.txt" Dim FileReader1 As New StreamReader(File.Open(destination, FileMode.OpenOrCreate)) Dim Contents1 As String For player = 1 To 4 For driver = 1 To 6 Contents1 = FileReader1.ReadLine playerdrivers(player, driver) = Contents1 Next Next FileReader1.Close()
Please could you help me by suggesting any improvements or how to get past this error.