| You are here: DEVPPL ‹ Forum ‹ Programming ‹ Visual Basic Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
visual basic 2010 express - using linq query
1 post
• Page 1 of 1
0
visual basic 2010 express - using linq query
Hi,
First off, I am a newbie programmer. I am trying to print an array to a text file. The array gets its data from a linq query using .toArray. The problem is that instead of the data from the query being written to the file, what I get in the file is this:
VB$AnonymousType_5`4[System.String,System.String,System.String,System.String][]
Here is the code snippet:
Dim search As String
search = InputBox("Enter search string")
If File.Exists("MyData.txt") Then
Dim myfile() As String = File.ReadAllLines("MyData.txt")
Dim query1 = From line In myfile
Let data = line.Split(","c)
Let iname = data(0)
Let idescrip = data(1)
Let ilocation = data(2)
Let ivalue = FormatCurrency(data(3))
Where search <> iname
Select iname, idescrip, ilocation, ivalue
Dim newFile() = query1.ToArray
lstDisplay.Items.Add(newFile)
Dim myfile2 = File.CreateText("MyData.txt")
Dim outputLine = newFile
myfile2.writeline(outputLine)
myfile2.Close()
Any help would be greatly appreciated!

First off, I am a newbie programmer. I am trying to print an array to a text file. The array gets its data from a linq query using .toArray. The problem is that instead of the data from the query being written to the file, what I get in the file is this:
VB$AnonymousType_5`4[System.String,System.String,System.String,System.String][]
Here is the code snippet:
Dim search As String
search = InputBox("Enter search string")
If File.Exists("MyData.txt") Then
Dim myfile() As String = File.ReadAllLines("MyData.txt")
Dim query1 = From line In myfile
Let data = line.Split(","c)
Let iname = data(0)
Let idescrip = data(1)
Let ilocation = data(2)
Let ivalue = FormatCurrency(data(3))
Where search <> iname
Select iname, idescrip, ilocation, ivalue
Dim newFile() = query1.ToArray
lstDisplay.Items.Add(newFile)
Dim myfile2 = File.CreateText("MyData.txt")
Dim outputLine = newFile
myfile2.writeline(outputLine)
myfile2.Close()
Any help would be greatly appreciated!
- Jdwbasic
- Reputation: 0
- Posts: 2
- Joined: Fri May 20, 2011 4:00 pm
- Highscores: 0
- Arcade winning challenges: 0
visual basic 2010 express - using linq query - Sponsored results
- Sponsored results
|
|