hi all,

i am a newbie to visual basic .net

i have a vb.net database that has 3 textboxs that go to a listbox and also store in a database.

i was wondering if i can extract the data from the listbox to excel like a csv file or something along them lines please help as i have no clue on how to do this.

thanks in advance to anyone that replys to this. :)

Recommended Answers

All 3 Replies

Two ways to do so:

1. Use Office-InterOp library.
2. Use ADo.NET OleDB provider.

i am new to this kinda thing is there any chance you could give me an example please and thank you for reply

To write to a csv file simply create a string with the values separated by commas and write it to a text file.
x = listboxitem1 & "," & listboxitem2 & "," & listboxitem3
Dim objReader As StreamWriter
objReader = New StreamWriter(YourFilePath)
objReader.Write(x)
objReader.Close()

It will then open in Excel automatically.

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.