hi i want to create a csv file using VB.net 2003 and save the data from an array in it... i have searched everywhere and i did not find a solution.
please help :'(

Recommended Answers

All 3 Replies

What type of array and how do you want to store it? If you have an integer array you could get away with storing the values in CSV without a text qualifier:

Public Class frmArray

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim lst As New List(Of Integer)
		lst.Add(1)
		lst.Add(2)
		lst.Add(3)
		Dim intArray As Integer() = lst.ToArray()
		'Now we have test data set up

		Dim lstString As New List(Of String)
		For Each i As Integer In lst
			lstString.Add(Convert.ToString(i))
		Next

		System.IO.File.WriteAllText("C:\file.csv", String.Join(",", lstString.ToArray()))

	End Sub
End Class

Please clarify on what type of array you have

it is a string two dimensional array

How do you want the dimensions split up then? Give us some sample data and sample output

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.