I created some code for a browse buton and it works, but I want to send the textbox information to the text file according to the headings that I have listed within it. I am getting an error when I put
Handles Browse.Click
and I get errors whenever I try to add
Response.Write(Me.username.Text)
and etc...to output all the textbox information from the form.
Below is my code, please tell me what I am doing wrong and what I can add in to get this done...
Thank you!
Protected Sub Browse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Browse.Click
Dim FileName As String = "ExporterOutput.txt"
Dim FilePath As String = "C:/Users/My Documents/ExporterOutput.txt"
Dim response As HttpResponse = HttpContext.Current.Response
response.ClearContent()
response.Clear()
response.ContentType = "text/plain"
response.AddHeader("Content-Disposition", ("attachment; filename = " & FileName & ";"))
response.TransmitFile(FilePath)
response.Write("Username:")
response.Write(Me.username.Text)
response.Write(" ")
response.Write(Date.Now.ToLongDateString() & " " & Date.Now.ToLongTimeString())
response.Flush()
response.End()
End Sub