CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Clear Feilds

  1. #1
    Join Date
    Jan 2000
    Posts
    19

    Clear Feilds

    How can I clear all the fealds on a form if the
    feilds are linked to a Data Base


    Thanks in Advance
    Donny S.


  2. #2
    Guest

    Re: Clear Feilds

    Try this:

    private Sub Command1_Click()
    Dim ctl as Control
    for Each ctl In Form1.Controls
    If TypeOf ctl is TextBox then
    ctl.Text = ""
    End If
    next
    End Sub



    Vlad


  3. #3
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Clear Feilds

    You could also call the AddNew method of the data control you are using. That should clear all the linked controls and allow for new info to be entered. Then when you want to save that info, you would call the Update method of the data control.

    HTH,
    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

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