473,785 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB-APP:Reset a DataGridView

4 New Member
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 5038
Motoma
3,237 Recognized Expert Specialist
Use the New keyword to assign and new (i.e. empty) datagridview to the variable.
Apr 9 '07 #2
vbbush
4 New Member
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 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
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
1791
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 - me.cancelbutton = btnCancel how do I change it back to (none)?
0
3629
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, and rebind the lstMyPersonnes to my DataGridView.dataSource, it shows the new record in the DataGridView as it should be. But when I click on a cell of that row, I suddenly got this error: "Index -1
6
6417
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 gave it a try using the example given in
4
10235
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 me to a document that shows how this can be done? Thank you
2
5558
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 widths so that next time the user uses the screen, I can reset the width to what they manually made the last time they were in the screen. The problem is that no matter what I do, the width always returns to the original width of the column. I can...
2
15166
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
26438
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 datagridview control? I am at a loss. Thanks, David
1
7786
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 course is a priority course or not. Simple. Because there is alot of data stored for each course, I am using a tab control with several pages. The Job Role cross-referencing comes on
2
2232
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. -------------------------------------- My Problem is this: -------------------------------------- I have 2 forms. The first form contains a DataGridView and a button. The DataGridView is bound to an access database, and loads at form_load. The second form contains several...
3
1838
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 columns are not filled in. Also when the user selects an Item (there is a combo fox on that column) I want to get the Price and fill in the Price column - what is the correct event to use for this?
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10100
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.