473,498 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with DataGridView

Hi,
I am having problems refreshing current cell, with DataViewGrid that
is bound with a DataTable.
I am doing CellValidating, and try to change the value of cell that I
am doing validating data.
But I can change value of a different cell, but I can not see the
change on same cell when CellValidanting method exits.
Then if I put the focus on this cell again I exit, HERE I can see the
change.

What am I doing wrong?
Thanks in advance.
************************************************** **********************
DataTable newOrder = new DataTable("NewOrderToLoad");
DataColumn codePart = new DataColumn("Code");
DataColumn descriptionPart = new DataColumn("Description");

dataGridView1.DataSource = newOrder;

private void dataGridView1_CellValidating(object sender,
DataGridViewCellValidatingEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Code")
{
if (e.FormattedValue.ToString().Trim() == "")
{
dataGridView1.Rows[e.RowIndex].ErrorText = "Invalid !!!";
e.Cancel = true;
}
string tmpStr =
myODBC.checkCodeAndFormatting(e.FormattedValue.ToS tring());
if (tmpStr == null)
{
dataGridView1.Rows[e.RowIndex].ErrorText = "Not exist
Code !!!";
e.Cancel = true;
}
else
{
dataGridView1.CurrentRow.Cells[0].Value = "DO NOT
MODIFY"; // HERE I AM PUTTING
//
RETURN CODE, BUT NOTHING
//
HAPPEND

dataGridView1.CurrentRow.Cells[1].Value = "DO
MODIFY"; // HERE I CAN MODIFY ANYTHING
}
}
}

Jun 27 '08 #1
1 1069
Somebody can help me please ?

Thanks !

Jun 27 '08 #2

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

Similar topics

0
1498
by: Paul Cheetham | last post by:
Hi, I have a DataGridView control, where I am setting its Datasource property to a datatable. The DataGridView has it's MultiSelect property set to false I also have a handler for the...
7
12550
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
4
1207
by: gordon | last post by:
Hi I am learning C# out of books - and soon will be attending some courses. I like to write a bit of code and see what happens, but I find that I get stuck at the same spot each time. my...
0
2352
by: Mike | last post by:
Hey everyone... I've got three problems with a custom DataGridView column I've built following the "How To: Host Controls in Windows Forms DataGridView Cells" article. The base editing control...
2
1158
by: Lloyd Sheen | last post by:
I add a DataGridView to a new form. Then click the tasks icon, then attempt to select datasource. I get an error "Error using the dropdown: Object reference not set to an instance of an object"....
0
2480
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by...
3
7107
by: Tony K | last post by:
When calling my form from within my MDI, I receive this error message. InvalidOperationException was unhandled An error occurred creating the form. See Exception.InnerException for details. The...
1
2210
by: =?Utf-8?B?Q2hyaXN0aWFuIFdlaW5lcnQ=?= | last post by:
Hello, I currently fight with a problem during the derivative of WinForm controls. In Visual Studio I created a new User Control. This control is derived from the DataGridView of the...
3
2151
by: Tony K | last post by:
VB 2005 - Windows Vista I have a form that seems to lock up when the number of rows exceed the height of the datagridview. The following code executes when data is received through the serial...
3
5701
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
0
7125
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
7002
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
7165
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,...
1
6887
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...
0
5462
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,...
1
4910
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...
0
3093
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...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.