PC Review


Reply
Thread Tools Rate Thread

clear datagrid

 
 
Weeepie
Guest
Posts: n/a
 
      26th May 2004
Hello,

Is it possible to clear a datagrid in VBdotNET?
I'm using a query to fill the datagrid, but when I change the parameter,
the next query follows the previous.
Is there someone who can help me.

Thx,

Weeepie.


 
Reply With Quote
 
 
 
 
William Ryan eMVP
Guest
Posts: n/a
 
      26th May 2004
Weepie:

I'm assuming you want to clear the datatable which will have the effect of
clearing the grid? To clear the datatable you can just call
DataTableName.Clear. So if you had 100 rows, then called .Clear, then in
the next query you called Fill again using the same Query you used the first
time (and just for example's sake, assume the data hasn't changed so you
should get the exact same results), then you'd have 100 rows now. Otherwise
with no Clear, you'd have 200 rows.

Remember that the grid is just the UI interface to the table and anything
done to a bound grid happens to the datasource.

On the other hand, if you really want to clear the datagird but not the
table, you'd need to clear the databindings but I don't think that's what
you are after.Let me know if it is.

Cheers,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
http://www.devbuzz.com/content/zinc_...center_pg1.asp
"Weeepie" <(E-Mail Removed)> wrote in message
news:HM1tc.743$%(E-Mail Removed)...
> Hello,
>
> Is it possible to clear a datagrid in VBdotNET?
> I'm using a query to fill the datagrid, but when I change the parameter,
> the next query follows the previous.
> Is there someone who can help me.
>
> Thx,
>
> Weeepie.
>
>



 
Reply With Quote
 
Weeepie
Guest
Posts: n/a
 
      27th May 2004
I'm gonna try.

Thx,
Weeepie.




"William Ryan eMVP" <(E-Mail Removed)> schreef in bericht
news:up%(E-Mail Removed)...
> Weepie:
>
> I'm assuming you want to clear the datatable which will have the effect of
> clearing the grid? To clear the datatable you can just call
> DataTableName.Clear. So if you had 100 rows, then called .Clear, then in
> the next query you called Fill again using the same Query you used the

first
> time (and just for example's sake, assume the data hasn't changed so you
> should get the exact same results), then you'd have 100 rows now.

Otherwise
> with no Clear, you'd have 200 rows.
>
> Remember that the grid is just the UI interface to the table and anything
> done to a bound grid happens to the datasource.
>
> On the other hand, if you really want to clear the datagird but not the
> table, you'd need to clear the databindings but I don't think that's what
> you are after.Let me know if it is.
>
> Cheers,
>
> Bill
>
> --
>
> W.G. Ryan, eMVP
>
> http://forums.devbuzz.com/
> http://www.knowdotnet.com/williamryan.html
> http://www.msmvps.com/WilliamRyan/
> http://www.devbuzz.com/content/zinc_...center_pg1.asp
> "Weeepie" <(E-Mail Removed)> wrote in message
> news:HM1tc.743$%(E-Mail Removed)...
> > Hello,
> >
> > Is it possible to clear a datagrid in VBdotNET?
> > I'm using a query to fill the datagrid, but when I change the

parameter,
> > the next query follows the previous.
> > Is there someone who can help me.
> >
> > Thx,
> >
> > Weeepie.
> >
> >

>
>
>



 
Reply With Quote
 
Weeepie
Guest
Posts: n/a
 
      27th May 2004
It works,

Thanks




"William Ryan eMVP" <(E-Mail Removed)> schreef in bericht
news:up%(E-Mail Removed)...
> Weepie:
>
> I'm assuming you want to clear the datatable which will have the effect of
> clearing the grid? To clear the datatable you can just call
> DataTableName.Clear. So if you had 100 rows, then called .Clear, then in
> the next query you called Fill again using the same Query you used the

first
> time (and just for example's sake, assume the data hasn't changed so you
> should get the exact same results), then you'd have 100 rows now.

Otherwise
> with no Clear, you'd have 200 rows.
>
> Remember that the grid is just the UI interface to the table and anything
> done to a bound grid happens to the datasource.
>
> On the other hand, if you really want to clear the datagird but not the
> table, you'd need to clear the databindings but I don't think that's what
> you are after.Let me know if it is.
>
> Cheers,
>
> Bill
>
> --
>
> W.G. Ryan, eMVP
>
> http://forums.devbuzz.com/
> http://www.knowdotnet.com/williamryan.html
> http://www.msmvps.com/WilliamRyan/
> http://www.devbuzz.com/content/zinc_...center_pg1.asp
> "Weeepie" <(E-Mail Removed)> wrote in message
> news:HM1tc.743$%(E-Mail Removed)...
> > Hello,
> >
> > Is it possible to clear a datagrid in VBdotNET?
> > I'm using a query to fill the datagrid, but when I change the

parameter,
> > the next query follows the previous.
> > Is there someone who can help me.
> >
> > Thx,
> >
> > Weeepie.
> >
> >

>
>
>



 
Reply With Quote
 
evansong@yahoo.com
Guest
Posts: n/a
 
      6th Jun 2004
Hi Weeepie,

If you want to completly disconnect your datagrid from the dataset and run different table with datagrid then,
you will have to do the following

Datagrid.DataSource = Nothing

However, you are just changing the parameter, so I presume you are using the same table.

Assuming that your query results were filled to dataset "objdsTest" and the datagrid was mapped to table name "Tempy", then..

Me.objdsTest.Tempy.Clear()

The line above will clear the data in dataset and so for the next query all you have to do is fill it in again.

' need your SQL command with different parameters first.
Me.daTempy.Fill(objdsTest)

I hope this was the solution for your problem.

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear Datagrid Gsurfdude Microsoft Access Form Coding 0 28th Feb 2008 01:29 PM
How do you clear a datagrid? Robert Johnson Microsoft VB .NET 2 9th Jul 2007 07:46 PM
clear datagrid Agnes Microsoft VB .NET 1 23rd Oct 2006 07:02 PM
How do you clear a datagrid? =?Utf-8?B?TWVyZGFhZA==?= Microsoft ASP .NET 0 30th Aug 2005 02:12 AM
DataGrid: How to clear the contents of a DataGrid Martin Marinov Microsoft ASP .NET 2 8th Jul 2004 05:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:31 PM.