Solved

VB.Net: Refresh ListView and DataGridView

Posted on 2012-04-09
3
1,155 Views
Last Modified: 2012-04-15
Hi Experts,

In a ListView or in DataGridView I fill data from the database, and the query may contain about a few hundred to thousands of records.

But if I make any changes to the values in the ListView or in the DataGridView (the changes are only to a few rows or for a few cells) and to view the changes I always refill the controls by re-querying, which is really inefficient.

Is there any method that I could use to only refresh a particular column or rows or cells, or a collection of them rather than refilling them in the ListView or in the DataGridView.

Thanks in advance.
0
Comment
Question by:baabaa_nl
3 Comments
 
LVL 12

Accepted Solution

by:
Alfredo Luis Torres Serrano earned 250 total points
ID: 37822950
Sure,

   You have to deal with the CellEndEdit method and each time a cell is changed do a look in the table for the specific index (Id) and if the value is diferent just update thtat value in the listview or datagrid.

Hope this helps
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 37832910
>But if I make any changes to the values in the ListView or in the DataGridView (the changes are only to a few rows or for a few cells) and to view the changes I always refill the controls by re-querying, which is really inefficient.

So you have two controls and you make changes in one and want to see the change reflected in another?
0
 

Author Comment

by:baabaa_nl
ID: 37846355
Hi CodeCruiser,

I am using a Single datagridview and i make changes to certain cells in the gridview and when i click the save button, is it possible the edited cell to be updated to the database or to the dataset.

Thanks in advance.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question