I have a problem with the datagrid where I wanted to detect any changes to
the grid, such as a record being changed, added or deleted. So I used the
currentcellchan ged method and used the code
below to update the database. But for some reason, it is detecting and
correctly updating the database on add and remove of records. But is not
writing cell changes back to the database. ANy ideas ?
'this sub will handle if a cell is changed or if a new record is added
Dim dgCell As DataGridCell = grdShoppingList .CurrentCell
Dim strIsle As String = grdShoppingList .Item(dgCell.Ro wNumber, 0).ToString
Dim strItem As String = grdShoppingList .Item(dgCell.Ro wNumber, 1).ToString
If strItem.Trim = "0" And strItem.Trim.Le ngth <> 0 Then
'do not add record if it is blank
'write updates to database file and set label to number of records
objShoppingList DA.Update(objSh oppingListDataS et, "ShoppingLi st")
updateShoppingL abel()
End If
ALso, is there any way to force a re-sort of the grid when I add or delete
records so that it is now sorted in the proper order ?
Thanks
----------
Tony 1 1483
Hi TM,
A datagrid is what it says a grid for data.
That data is alway in a ilist class (for a datagrid mostly a datatable I
think) often it is filtered by a dataview.
Therefore to see the changes (and I keep it simple by asuming you use a
datatable) you can watch the changes in the datatable. (A datatable can be a
part of a dataset)
I hope this helps a little bit.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: BFX |
last post by:
Hi All,
I have datagrid with binding on dataset
this.grdMachineType.DataMember = "MachineTypes";
this.grdMachineType.DataSource = this.dsMachineTypes;
After append new row in datagrid i call this
|
by: Chris Plowman |
last post by:
Hi all,
I was wondering if anyone can help me with a really annoying problem I have
been having. I made a derived datagrid class that will select the row when
a user clicks anywhere on a cell (multi-select without modifier keys). I
got that working fine, but I also wanted to keep rows selected after a sort,
which I do by storing the row's id in an arraylist. The idea was to do the
sort and then go back and re-select the rows with that...
|
by: Emerson |
last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C#
Here's my scenario
I click in a cell on a DataGrid. I enter some text. Before changing to another cell in the DataGrid, I move my mouse pointer off the DataGrid and change the selected item in a ListBox or TreeView.
Here's my question
Which should fire first, the DataTable's RowChanged/CellChanged event or...
|
by: Lyners |
last post by:
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value.
My probelm.... when I have the user press the update button (which does a
post back that loops through the datagrid and updates a database) the
field/cell that is filled by the javascript appears to be blank in my update
code, even though I can...
|
by: Earl |
last post by:
I want to fire a database update off of a single change to a single cell in
the datagrid. This apparently cannot be done using keypress, keyup, keydown,
etc. I've read George Shepard's FAQ and while I may have overlooked it, I
have not found an answer. I now am using the CurrentCellChanged event, and
this is satisfactory IF the user moves off of the cell before closing the
form. An obvious alternative would be to check for changes before...
| |
by: Brian Hoops |
last post by:
I have a windows forms datagrid and I would like to be able to recognize
when changes have been made in order to perform the update. I tried the
following, which works well, but only if the user changes rows at some
point. If they enter the grid, change a cell, and then click close it does
not see the change. The same holds true if they enter the grid, change a
cell, arrow right or left to a different cell and change that value. If...
|
by: rn5a |
last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB
table. Users can modify the records using this DataGrid for which I am
using EditCommandColumn in the DataGrid. This is the code:
<script runat="server">
Dim sqlConn As New SqlConnection(".....")
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
If Not (Page.IsPostBack) Then
FillDataGrid()
|
by: Martin |
last post by:
Hi all,
This is the situation...
DatagridView Control with datasource set to datatable.
I want the user to be able to delete x number of rows by selecting a row
with mouse then clicking a 'delete' button.
Then user clicks a 'Commit' button to update the database.
|
by: Ahmed Yasser |
last post by:
Hi all,
i have a problem with the datagridview sorting, the problem is a bit complicated so i hope i can describe in the following steps:
1. i have a datagridview with two columns (LoginName,UserName)
2. the datagridview sorting is set to automatic, so when i click on the column header is sorts well.
3. i put in an event handler for the CellEndEdit Event, so whenever the user of the program changes the content of a cell in the LoginName...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |