473,698 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid CurrentCellChan ged

Hello all,

I'm trying to find a way to get a event raised when you change some text on
a DataGrid Cell, I need to be able to search in another table what the user
typed on that cell.

I found this, but this only give me the row and the cell I change position
to.

[C#]
// Create an instance of the 'CurrentCellCha nged' EventHandler.
private void CallCurrentCell Changed()
{
myDataGrid.Curr entCellChanged += new EventHandler(Gr id_CurCellChang e);
}

// Raise the event when focus on DataGrid cell changes.
protected void Grid_CurCellCha nge(object sender, EventArgs e)
{
// String variable used to show message.
string myString = "CurrentCellCha nged event raised, cell focus is at ";
// Get the co-ordinates of the focussed cell.
string myPoint = myDataGrid.Curr entCell.ColumnN umber + "," +
myDataGrid.Curr entCell.RowNumb er;
// Create the alert message.
myString = myString + "(" + myPoint + ")";
// Show Co-ordinates when CurrentCellChan ged event is raised.
MessageBox.Show (myString, "Current cell co-ordinates");
}
Anyone know?

Thanks
Nov 15 '05 #1
1 12265
The Validating event might work for you. It gets fired
before the cell is actually exited. It has the added
advantage that you can cancel out and display an error
message if you don't find what you are looking for.
-----Original Message-----
Hello all,

I'm trying to find a way to get a event raised when you change some text ona DataGrid Cell, I need to be able to search in another table what the usertyped on that cell.

I found this, but this only give me the row and the cell I change positionto.

[C#]
// Create an instance of the 'CurrentCellCha nged' EventHandler.private void CallCurrentCell Changed()
{
myDataGrid.Curr entCellChanged += new EventHandler (Grid_CurCellCh ange);}

// Raise the event when focus on DataGrid cell changes.
protected void Grid_CurCellCha nge(object sender, EventArgs e){
// String variable used to show message.
string myString = "CurrentCellCha nged event raised, cell focus is at "; // Get the co-ordinates of the focussed cell.
string myPoint = myDataGrid.Curr entCell.ColumnN umber + "," + myDataGrid.Curr entCell.RowNumb er;
// Create the alert message.
myString = myString + "(" + myPoint + ")";
// Show Co-ordinates when CurrentCellChan ged event is raised. MessageBox.Show (myString, "Current cell co-ordinates");
}
Anyone know?

Thanks
.

Nov 15 '05 #2

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

Similar topics

8
7842
by: amber | last post by:
Hello, How can I trigger an event, when a value (cell) in my datagrid changes? TIA, amber
2
1868
by: PAUL GROSSMAN | last post by:
Hello everyone. I am working with a DataGrid using VB .Net (Windows Forms). I want to make one of the columns un-editable. I was able to do that by setting the .dsName.Tables("TblName").Columns("ColName").ReadOnly = True That made it so you can't change the value in the column, but you're still tabbing into the column (despite the fact you can't change it).
3
2808
by: Maqsood Ahmed | last post by:
Hello, Here is the scenario: I have a datagrid on a winform and a datatable is set as its datasource. I have added DataGridTableStyle in datagrid's TableStyles property. Some of Gridstyles are numeric (doubles) and I have set their format to #,0.0000 since I want to display the values to comma seperated (at thousands) and till four decimal places. User can also edit values in the grid. So far so good. The Problem:
4
7369
by: Suzanne | last post by:
Hi all, I'm having problems with datagrids and the currentcellchanged event. My problem is this: I have a datagrid on a form, if the user changes the text in a cell on the datagrid then tries to close the form via a button on the toolbar (with going to another cell in the datagrid)I want to be able to popup a messagebox to the user asking them if they want to keep their changes. At the momment I'm accomplishing this by a property that...
3
2155
by: Arsalan | last post by:
How do I validate inputs in DataGrid ? I want to check for constraint and change columns value dynamically, for e.g i've column named employee, annual salary and salary I want the columns annual salary to be dynamically changed when user changes salary in datagrid How do I do it?
5
1588
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...
9
394
by: BK | last post by:
In VB.Net (1.1 framework), I have a datagrid that displays records from a SQL table. Only some of the columns are editable. When the user changes data in 2 and only 2 of the columns, I want to perform some calculations. There are about a dozen fields, only 3 of them are editable and I only want to perform the calculations when the user has changed the data in either of 2 columns. I have posed this before without any suggestions that...
6
2241
by: Doug Bell | last post by:
Hi I have a DataGrid with some hidden columns and also some read Only and some ComboBox Columns. Sandard Tabbing through the Datagrid sees the focus go to the hidden columns requiring further Tabbing to get to the desired column but it works fine stopping correctly on the ComboBox column. I have built a routine to test whether the use is Tabbing forward or back (Shift Tab) by looking at the last location, not by trapping the Keys. If
5
2005
by: cj | last post by:
This should be easy. I have a datagrid filled with data and when I click on a cell I want that data displayed in a text box. How do I do this? Thanks. P.S. this is a 2005 windows app.
0
8668
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...
0
8598
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,...
0
9152
Oralloy
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...
0
9014
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 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...
0
5857
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();...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3037
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
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1995
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.