473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

clear datagrid

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.
Jul 21 '05 #1
4 9521
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" <we*****@hotmail.com> wrote in message
news:HM********************@hestia.telenet-ops.be...
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.

Jul 21 '05 #2
I'm gonna try.

Thx,
Weeepie.


"William Ryan eMVP" <do********@comcast.nospam.net> schreef in bericht
news:up****************@TK2MSFTNGP09.phx.gbl...
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" <we*****@hotmail.com> wrote in message
news:HM********************@hestia.telenet-ops.be...
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.


Jul 21 '05 #3
It works,

Thanks


"William Ryan eMVP" <do********@comcast.nospam.net> schreef in bericht
news:up****************@TK2MSFTNGP09.phx.gbl...
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" <we*****@hotmail.com> wrote in message
news:HM********************@hestia.telenet-ops.be...
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.


Jul 21 '05 #4
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...
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mike L | last post by:
This is for a Win form. How do I clear all the rows in a datagrid? How do I add a record to a datagrid?
1
by: Lee Price | last post by:
This is with regard to my previous post for resetting my DataGrid, and I was adviced to use the clear function on DataGrid items by Sachan The datagrid does not have a Clear function and I get...
4
by: aikwee | last post by:
how, how do i clear the current content of a datagrid? I am using datagrid to do a xml editor, so every time i try to open anther file and load it to datagrid, it actually append it in to...
4
by: Alan | last post by:
I have set the datasource of the datagrid to a datatable. How do I clear the datagrid contents before refill the datagrid everytime ?
4
by: Weeepie | last post by:
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...
0
by: Flack | last post by:
I have pasted at the end of this message a small sample program I whipped up to do some testing. It's a form with a datagrid and two buttons. Each button clears the dataTable that is the source...
2
by: harini | last post by:
hi, i have a radio button. On clicking the radio button i have to clear the already existing tablestyle of my datagrid and bind a new table to the grid with a new tablestyle. i used, ...
5
by: Steve | last post by:
In VB6 I have a screen the has a text box and a datagrid If I click the datagrid, the 1st event is to validate the textbox and then the 2nd event is a datagrid mousedown event. If a get an error...
4
by: inadsad | last post by:
Good day Group, I have a form with a datagrid and two buttons. On show button datagrid is populated with a datatable and on clear button datagrid is cleared. DataTable.Clear not only removes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.