Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. reset form

reset form

Scheduled Pinned Locked Moved Visual Basic
jsonhelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lupa nikki
    wrote on last edited by
    #1

    This is the code: Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click TextBox1 = Nothing TextBox2 = Nothing TextBox3 = Nothing TextBox5 = Nothing TextBox6 = Nothing DateOfbirth = Now TextBox7 = Nothing TextBox8 = Nothing TextBox9 = Nothing TextBox10 = Nothing TextBox11 = Nothing Department = "Administration" personal = New Personal when i click the rest button nothing happens. when i use Form.reset() it doesnt change anything either. Can someone please help? :confused: -- modified at 20:16 Tuesday 4th April, 2006

    G S 2 Replies Last reply
    0
    • L lupa nikki

      This is the code: Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click TextBox1 = Nothing TextBox2 = Nothing TextBox3 = Nothing TextBox5 = Nothing TextBox6 = Nothing DateOfbirth = Now TextBox7 = Nothing TextBox8 = Nothing TextBox9 = Nothing TextBox10 = Nothing TextBox11 = Nothing Department = "Administration" personal = New Personal when i click the rest button nothing happens. when i use Form.reset() it doesnt change anything either. Can someone please help? :confused: -- modified at 20:16 Tuesday 4th April, 2006

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      That is because you are not doing anything at all to the controls. The TextBox1 variable is not a textbox, it's only a reference to the textbox. When you set the variable to Nothing, you are only throwing away your reference to the control. That doesnt affect the control the least bit, it couldn't care less whether you have a reference to it or not. If you want to change the contents of the control, set the Text property of the control. --- b { font-weight: normal; }

      L 1 Reply Last reply
      0
      • G Guffa

        That is because you are not doing anything at all to the controls. The TextBox1 variable is not a textbox, it's only a reference to the textbox. When you set the variable to Nothing, you are only throwing away your reference to the control. That doesnt affect the control the least bit, it couldn't care less whether you have a reference to it or not. If you want to change the contents of the control, set the Text property of the control. --- b { font-weight: normal; }

        L Offline
        L Offline
        lupa nikki
        wrote on last edited by
        #3

        Thankyou heaps i have got it to work now. your a great help. :-D just one more thing, im trying to get my application to send an email to the user if they forget their password, the code is: If My.User Is Authenticated Then txtUser.Text = My.User.Name If userExists(My.User.Name) Then txtPassword.Focus() Else : NewUser = True MessageBox.Show("You are new to the system, please select request account and enter your details", "User Information") End If Else if MessageBox.Show("Sorry you are not authenticated to use this program" & vbNewLine & "If you are a staff member please select help or contact us") End If im not sure how to declair Authenticated,userExists and new user. With userExists i need to get it to check the database where all the users are stored yes? but im not to sure how to do this :omg:

        F 1 Reply Last reply
        0
        • L lupa nikki

          Thankyou heaps i have got it to work now. your a great help. :-D just one more thing, im trying to get my application to send an email to the user if they forget their password, the code is: If My.User Is Authenticated Then txtUser.Text = My.User.Name If userExists(My.User.Name) Then txtPassword.Focus() Else : NewUser = True MessageBox.Show("You are new to the system, please select request account and enter your details", "User Information") End If Else if MessageBox.Show("Sorry you are not authenticated to use this program" & vbNewLine & "If you are a staff member please select help or contact us") End If im not sure how to declair Authenticated,userExists and new user. With userExists i need to get it to check the database where all the users are stored yes? but im not to sure how to do this :omg:

          F Offline
          F Offline
          FrankyT
          wrote on last edited by
          #4

          on the topic of email, this is how I do it for VB forms. it also works when exposed through a web service. Imports system.net.Mail public class mailer Private email As MailMessage Private webmailer As System.Net.Mail.SmtpClient Private Sub sendMail() email = New MailMessage("Sender Email", "Reciepient Email", "Subject Text", _ "Body Text") webmailer = New System.Net.Mail.SmtpClient("SMTP Server Name as String", _ "SMTP service port: usually 25") With email .Attachments(0) = New Attachment("c:\SomeFile.txt") .Attachments(1) = New Attachment("c:\SomeOtherFile.txt") End With webmailer.Send(email) End Sub end class server admin has a big impact on whether this will work. if it fails it may not be the code, but the smtp server configuration. good luck hey...slang is the vernacular for the vernacular...wow -- modified at 21:35 Tuesday 4th April, 2006

          1 Reply Last reply
          0
          • L lupa nikki

            This is the code: Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click TextBox1 = Nothing TextBox2 = Nothing TextBox3 = Nothing TextBox5 = Nothing TextBox6 = Nothing DateOfbirth = Now TextBox7 = Nothing TextBox8 = Nothing TextBox9 = Nothing TextBox10 = Nothing TextBox11 = Nothing Department = "Administration" personal = New Personal when i click the rest button nothing happens. when i use Form.reset() it doesnt change anything either. Can someone please help? :confused: -- modified at 20:16 Tuesday 4th April, 2006

            S Offline
            S Offline
            Scott Page
            wrote on last edited by
            #5

            Make sure you are setting the .Text property to "" or String.Empty. You are attemting to set the Controls (TextBox1, TextBox2, etc.) to Nothing. Example TextBox1.Text = String.Empty This also works TextBox1.Clear Hope this helps :-D "Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem." ( President Ronald Reagan)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups