Connecting Tech Pros Worldwide Forums | Help | Site Map

Save File Dialog to .CSV

Member
 
Join Date: Nov 2006
Location: Washington
Posts: 41
#1: Dec 4 '06
Hi,

I am pretty new to VB.NET. I am creating an application where I need to save information that is being displayed in a listbox to a .csv file format. I have examples of rich text files, but none of .CSV format saving. Is there anybody that can help me?

Thanks

kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#2: Dec 5 '06

re: Save File Dialog to .CSV


Hi there,

I did something with an .xls that you may be able to modify:

Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=PerformanceAdmin.xls")

Response.Charset = ""

Response.Cache.SetCacheability(HttpCacheability.No Cache)

Response.ContentType = "application/vnd.xls"

Dim stringWrite As New System.IO.StringWriter

Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)

Me.dgPerformanceAdmin.RenderControl(htmlWrite)

Response.Write(stringWrite.ToString())

Response.End()

Hope that this helps.
Reply