Results 1 to 6 of 6

Thread: DBGrid doesnt show records after delete....

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Asia
    Posts
    6

    Unhappy


    Can anyone tell me why the DBGrid control doesnt show the new records I add after I delete all the displayed records?
    The records do get added but just not displayed.

    Although refreshing the Data Control does bring back the
    records I dont know where I can put the "Data1.refresh "
    statement as I get errors.

    I tried the Reposition event ,didnt work. I tried the
    afterinsert event , definietly didnt work!

    I dont want to have a button to refresh the Data control.

    Can some one help me?

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Asia
    Posts
    6
    Thanks Psyrus

    But where is "after adding a record" ?
    adding records is automatically handled by the DBGrid and Data control. So I have to use an event but I cant put the refresh inside any of the DBGrids events as I get errors.

    I cant put the refresh statement inside the reposition event as that results in somekind of recursion!

    Thanks for answering!

  3. #3
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    How about this:


    Private Sub DataGrid1_AfterUpdate()

    DataGrid1.Refresh

    End Sub

    Or am I thinking of the wrong control.



    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Asia
    Posts
    6
    Sorry I didnt respond earlier, I have been rather busy...

    Thanks again Psyrus!

    But when I do the above I get an error which say something
    like "Cannot execute method in current context" ( for the
    refresh method). I assume it is not possible to call any method on the underline recordset of the data control linked to the Grid while I am inside any event belonging to
    the Grid.

    Then what's the solution? Beat's me.

    Thanks a million for replying Psyrus!!!


  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Post the code you're having problems with.

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Asia
    Posts
    6
    Well there really is no code at all.....

    Just add a DBGrid to a form, then link it to a Data Control.
    Thats all.
    Try adding a few lines then delete all of them.
    Try to add a record via the grid and Hey? It dissapears!



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