[SOLVED] Make user download something as a file

Answered
0
0

Howdy,

I’d like to create a list of something, and want the user to download that information.
Is it possible to help me on what’s missing here to make the download dialog appear in the user end?
==

Dim ms As New IO.MemoryStream
Dim writer = New IO.StreamWriter(ms)
For i As Int32 = 0 To grid.RowCount – 1
writer.WriteLine(“Hello, World!”)
Next
writer.Flush()

  • You must to post comments
Great Answer
0
0

Thanks Levie,

I just recoded like this, works perfectly.

Dim Str As String = String.Empty
For i As Int32 = 0 To grid.RowCount – 1
Str &= grid.Rows(i)(“userid”).Value & “;” & vbCrLf
Next
Dim stream As New IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(Str))
Application.Download(stream, “email-export.csv”)

  • You must to post comments
0
0

Hi Jorge,

Check out this example of using different download options: https://github.com/iceteagroup/wisej-examples/tree/2.0/Download

Save File Dialog Info: https://stackoverflow.com/questions/28576438/how-to-download-a-file-in-c-sharp-with-a-popup-asking-where-to-save-file

Let me know if this works for you.

Best regards,

Levie

  • Jorge Bastos
    Perfect, Thanks!
  • Jorge Bastos
    Ops to soon. What am I doing wrong here? Dim stream As New IO.MemoryStream Dim writer = New IO.StreamWriter(stream) For i As Int32 = 0 To grid.RowCount – 1 writer.WriteLine(grid.Rows(i)(“userid”).Value) Next writer.Flush() Application.Download(stream, “email-export.csv”)
  • Luca (ITG)
    Your stream is at the end.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.