CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Posts
    8

    Clearing text boxes

    I was trying to figure out how to clear out the information someone has filled into a series of textboxs after they click the submit button.

    another words, they data the entered has been put in a database and I don't want the person to have the option of clicking submit again.

    thanks

    guyute

  2. #2
    Join Date
    Mar 2003
    Location
    RSA
    Posts
    16
    What might be a simplistic manner and their would possibly be a better manner of doing this, but I would just set the text box being equal to nothing within the code of the submit button.

    If submit button code has executed correctly,
    textbox.text = ""
    else
    do so form of an error message.
    end if

    This has worked fine for me, it is just that it is extremely tedious if you have many text boxes.

  3. #3
    Join Date
    Feb 2003
    Posts
    8
    thank you for replying, but i still don't quite understand. how do i code "If submit button code has executed correctly"

    is there a way to see if the database has been contacted, or if they textbox's have been loaded into variables? possible some type of boolean?

    or maybe i'm just missing something, need to stop drinking so much.

    thanks for answering.

    guyute

  4. #4
    Join Date
    Dec 2001
    Location
    Canada/Montreal
    Posts
    983
    You can do something like this:
    PHP Code:
    // user pressed the submit button
    if(submit.count>0)
    {
      
    // check whether user has entered something in the textfield
      
    if(textfield.Text==""// textfield is empty
         
    do something....
      else
         do 
    something else... // textfield is not empty

    Hope this helps, Sonu
    Sonu [MVP, MCAD.NET]
    Website: http://DotNetSlackers.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured