0

Below is (the main bit) of my code to collect emails and save them in a text file. But my text file isn't happening. Something wrong in my Sub Email_valid routine Any clues ?

Thanks in advance, Steve

Sub txtemail_EnterPressed

    Dim matcher1 As Matcher

Goodemail=False

matcher1 = Regex.Matcher("\w+@\w+\.\w+", txtemail)

    Do While Matcher1.Find
        Goodemail=True
    Loop 
    If Goodemail=False Then
        Msgbox("please input a valid email address", "Sorry")
    Else
        Msgbox("You will recieve an email shortly","Thank you")
        Email_valid
    End If

End Sub

Sub Email_valid

Writer.Initialize(File.OpenOutput(File.DirDefaultExternal, "Emai1s.txt",True))
Writer.WriteLine(txtemail)
Writer.Close 
txtemail.Text=""
Goodemail=False

End Sub

  • OK, for some reason I've got a -1. I'm trying to write a txt file to the sd card (which is present), but the file just doesn't get made, as a very very newbie have I misunderstood somethiing ?? – user1028366 Nov 04 '11 at 10:45
  • Hi Guys, OK It is getting made (found it now), but the file contains left, top, width, height, tag AND the email text. I only want it to save email txt (so it can be read into a PC using a 3rd party piece of software), why is the additional stuff there ? can it be ommitted easily ? – user1028366 Nov 04 '11 at 10:59
  • I found the file - DOH ! However - to only get the text to write it was Writer.WriteLine(txtemail.text) - missing off the .text wrote other txtemail properties. The delights of being a newbie I guess. Cheers – user1028366 Nov 04 '11 at 11:12

1 Answers1

0

As you wrote:

Writer.WriteLine(txtemail)

Writes the string representation of EditText to the file.

Erel
  • 1,802
  • 2
  • 15
  • 58