I remember reading something in the past aboout storing form values into strings, then the strings into a .txt document, but that was all about VB 6.0. Could someone give me some source, and even better, an explanation as to how I can make it so the user clicks 'Submit', and their email address (from a input box with name="email" id="email") is stored in a .txt document.

<%@ Import Namespace="System.IO" %>
<script language="vb" runat="server">
  sub Page_Load(sender as Object, e as EventArgs)
    'This will create the file if it doesn't exist, and will also
    'continue to add text to the file. To overwrite the file,
    'just remove the true attribute.
    Dim objStreamWriter As New StreamWriter(FileName, true)

    objStreamWriter.WriteLine(Request.Form("email") & ";" & vbCrLf)
    objStreamWriter.Close()
    
''Now to read the text file and display contents:

    'Get a StreamReader class that can be used to read the file
    Dim objStreamReader as StreamReader
    objStreamReader = File.OpenText(FileName)

    'Now, read the entire file into a string
    Dim contents as String = objStreamReader.ReadToEnd()

    'We may wish to replace carraige returns with <br>s
    lblNicerOutput.Text = contents.Replace(vbCrLf, "<br>")
    
    objStreamReader.Close()
  end sub
</script>

The above post continues to add onto the file, so eventually if 10,000 people fill out your form, you will have 10,000 lines of emails.

Sorry for the late reply, :(. I've been really busy with my .net work for my course. Thanks for the assistance, this will really help me, as I've not yet been able to read this section of my ebook. I'll add to your reputation again, :).

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.