If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Reg: Clear DBGRID

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-16-03, 02:23
gopi76 gopi76 is offline
Registered User
 
Join Date: Oct 2003
Posts: 6
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
Reply With Quote
  #2 (permalink)  
Old 10-23-03, 06:00
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
Arrow coud this help

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

Me.DBGrid1.Refresh

End Sub
Reply With Quote
  #3 (permalink)  
Old 10-23-03, 09:17
sundialsvcs sundialsvcs is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 10-27-03, 21:09
gopi76 gopi76 is offline
Registered User
 
Join Date: Oct 2003
Posts: 6
Re:Thanks

thank you Marvel...

Regards
Sudhagar.S

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

Me.DBGrid1.Refresh

End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On