Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    6

    Unanswered: Reg: Clear DBGRID

    Hello All.

    I am using DATAGRID in my VB6 forms. Once after loading, I would like to clear it,using CLEAR button. I dont find ANY CLEAR option for this datagrid control.

    Can u pls help me to solve this .

    Thanks
    Regards
    Sudhagar.S

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Arrow coud this help

    Private Sub Command1_Click()
    Set Me.DBGrid1.DataSource = Nothing
    Me.DBGrid1.ClearFields
    Me.DBGrid1.ReBind

    Me.DBGrid1.Refresh

    End Sub

  3. #3
    Join Date
    Oct 2003
    Posts
    706

    Wink

    If you're using a control that's designed to be bound to a datasource, you should always use it in that manner. If you want to "clear it" and so-forth without affecting the underlying data-source, plan to load data into the grid (and to save data from it) programmatically. In other words, your own code.

    Even though data-aware controls are convenient, they're convenient only when used for their intended purpose ... and a headache otherwise. Funky code that "you managed to get it to work" and a slew of maintenance problems thereafter.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  4. #4
    Join Date
    Oct 2003
    Posts
    6

    Re:Thanks

    thank you Marvel...

    Regards
    Sudhagar.S

    Originally posted by Marvels
    Private Sub Command1_Click()
    Set Me.DBGrid1.DataSource = Nothing
    Me.DBGrid1.ClearFields
    Me.DBGrid1.ReBind

    Me.DBGrid1.Refresh

    End Sub

Posting Permissions

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