473,387 Members | 1,621 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,387 software developers and data experts.

VB-APP:Reset a DataGridView

4
In VB 2005, I am trying to reset a datagridview to its original state (as in..completely filled with all data).

When the form loads, the datagridview is completely filled, however, after using a rowfilter, I would like to be able to reset the datagridview back to its original state.

This one has me stumped. If anyone could provide some assistance, I would definately appreciate it. It seems like it should be something relatively easy, but it has got me at a standstill.

Thanks in advance.
Apr 9 '07 #1
7 4994
Motoma
3,237 Expert 2GB
Use the New keyword to assign and new (i.e. empty) datagridview to the variable.
Apr 9 '07 #2
vbbush
4
Use the New keyword to assign and new (i.e. empty) datagridview to the variable.
I am not completely sure as to what you mean by that.
Here is a small segment of my code. Where would i be assigning a New DataGridView? I tried a few different things with it, but nothing worked. Any ideas?



Expand|Select|Wrap|Line Numbers
  1. Dim myView As DataView
  2. myView = CardsDataSet.Tables(0).DefaultView
  3.    Sub BookSearch()
  4.  
  5.         strBook = txtBook.Text
  6.  
  7.         'Book Location search and all other possibilities
  8.         If filBook = "1" Then
  9.             myView.RowFilter = "[Book Location] ='" & strBook & "'"
  10.             cardsDG.DataSource = myView
  11.         End If
  12.     End Sub
  13.  
Apr 9 '07 #3
Motoma
3,237 Expert 2GB
If I understand you correctly, you are trying to get myView to be empty again.
To do this, you would put this where you want to clear it:
Expand|Select|Wrap|Line Numbers
  1. myView = New DataView
  2.  
Apr 9 '07 #4
vbbush
4
If I understand you correctly, you are trying to get myView to be empty again.
To do this, you would put this where you want to clear it:
Expand|Select|Wrap|Line Numbers
  1. myView = New DataView
  2.  
Oh. No, I actually want myView to display all of the records...not none of the records.

And by the way, thank you for replying to this.
Apr 10 '07 #5
Motoma
3,237 Expert 2GB
Oh. No, I actually want myView to display all of the records...not none of the records.

And by the way, thank you for replying to this.
I am not familiar with the rowfilter construct, but I imagine if you set it to it's original value, you would have the entire dataset again.

Sorry I couldn't be more help...If this doesn't work let me know, and I'll make some more stuff up :D
Apr 10 '07 #6
vbbush
4
I am not familiar with the rowfilter construct, but I imagine if you set it to it's original value, you would have the entire dataset again.

Sorry I couldn't be more help...If this doesn't work let me know, and I'll make some more stuff up :D
haha. I can't figure out how to set it to its original value. I have tried just about everything i can think of to reset this and searched all over the internet trying to get ideas and I can't find a thing.

So, if you could make some stuff up, that would be great! Thanks anyhow.
Apr 10 '07 #7
Motoma
3,237 Expert 2GB
Store the rowfilter value before you set it, then restore it. Hehe.
Apr 10 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Michael Beatty | last post by:
In my application the accept and cancel buttons change depending on which panels are visible, my question is how do I reset the cancel button to "(none)" property. to change the buttons I use -...
0
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes,...
6
by: dbuchanan | last post by:
Hello, Is this a bug? Is there some kind of work around? I want to add default values for a few columns in my datagridview I found the "DefaultValuesNeeded" event for the datagridview I...
4
by: dm1608 | last post by:
Hello, I have a DataGridView control in VB.NET 2005 that I would like to iterate thru row by row and parse out the individual columns into variables. Can someone provide me example code or direct...
2
by: Eric Fortin | last post by:
I have a DataGridView that I bind to a dataset at runtime (I do not set up the data grid view for binding to that specific dataset at design time) and I want to save the manually resized column...
2
by: Bob | last post by:
How do I show a calendar control or another appropriate control to pick a date and time for a cell in a column in a datagridview? Thanks for any help. Bob
8
by: | last post by:
I am sure this has been asked and answered, but here goes anyway... VS.Net 2005, VB.Net How can you display more than one field in the displaymember property of a combobox inside the...
1
by: Karl | last post by:
Hi all... This is a good one. You'll like this... I am working on a course management tool that allows certain Courses to be cross referenced with Job Roles and, when they are, whether the...
2
by: snowdog17 | last post by:
Hello, I am a student and I need help with my VB task. I am currently using VB 2005 Express and I am fairly new to it, although I have programed in Delphi before....
3
by: Gail248 | last post by:
I have a datagridview that I am using for filling in the detail of an Invoice. So each row has Item, Quantity, Price. I want to prevent the user from adding new rows if the Quantity and Price...
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
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: 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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.