473,769 Members | 3,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

delete multiple lines in DataGrid, message always shown deleting the first line



private void dt_RowDeleted(o bject sender, DataRowChangeEv entArgs e)
{
int id= (int)e.Row["id", DataRowVersion. Original];

if(id >5)
{
e.Row.RejectCha nges();
MessageBox.Show (this, "Can not delete!" + id);
}

}
When multile lines are selected and deleted from the datagrid by using
delete key.

The warning message showned by MessageBox.Show () always same. id never
changed, always the firt one.

Is this a known bug, any work around?

Thanks a lot!
Ryan Liu
Mar 6 '06 #1
2 1163
Don't know if it applies in this case & don't have the details handy, but
whenever I've had to delete multiple rows, you have to start at the last one
and work your way up. Something about the id changing if you delete working
down

"Ryan Liu" wrote:


private void dt_RowDeleted(o bject sender, DataRowChangeEv entArgs e)
{
int id= (int)e.Row["id", DataRowVersion. Original];

if(id >5)
{
e.Row.RejectCha nges();
MessageBox.Show (this, "Can not delete!" + id);
}

}
When multile lines are selected and deleted from the datagrid by using
delete key.

The warning message showned by MessageBox.Show () always same. id never
changed, always the firt one.

Is this a known bug, any work around?

Thanks a lot!
Ryan Liu

Mar 7 '06 #2
I think this is very good point.

But it is out of my contorl. Deleteing multiple line by "Del" key and
raising deleted event are both build-in function of datagrid.

Maybe Microsoft should take your suggestion into account.

Ryan Liu
"Taras" <Ta***@discussi ons.microsoft.c om> дÈëÓʼþ
news:18******** *************** ***********@mic rosoft.com...
Don't know if it applies in this case & don't have the details handy, but
whenever I've had to delete multiple rows, you have to start at the last one and work your way up. Something about the id changing if you delete working down

"Ryan Liu" wrote:


private void dt_RowDeleted(o bject sender, DataRowChangeEv entArgs e)
{
int id= (int)e.Row["id", DataRowVersion. Original];

if(id >5)
{
e.Row.RejectCha nges();
MessageBox.Show (this, "Can not delete!" + id);
}

}
When multile lines are selected and deleted from the datagrid by using
delete key.

The warning message showned by MessageBox.Show () always same. id never
changed, always the firt one.

Is this a known bug, any work around?

Thanks a lot!
Ryan Liu

Mar 7 '06 #3

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

Similar topics

6
7798
by: Daniel Jung | last post by:
Hi This is not a "CSS I want you to do for me since my boss needs it yesterday"... I am wondering about a few things, and I am still working on this, but wanted to share it with you at this stage. Maybe you have some input, which I would appreciate. I made a tab-like display of a <ul>. It's easier shown than explained, so here is the link: http://lingo.uib.no:9002/MOO_info/main.html
32
14893
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
1
1239
by: Woody Splawn | last post by:
I have a datagrid. Through the normal means I highlight a record in the datagrid and press the delete key. I say yes and the record is deleted. However, in this case I need to run some code after deleting the record that scans the table and puts values in a BalDue field. The code is in a sub routine called CalcBal(). How is it possible for me to run this code after deleting a record in a grid? In what event could I place a call to...
2
1931
by: Ryan Liu | last post by:
private void dt_RowDeleted(object sender, DataRowChangeEventArgs e) { int id= (int)e.Row; if(id >5) { e.Row.RejectChanges(); MessageBox.Show(this, "Can not delete!" + id); }
13
2481
by: a.zeevi | last post by:
free() multiple allocation error in C ==================================== Hi! I have written a program in C on PC with Windows 2000 in a Visual C environment. I have an error in freeing multiple allocation as follows: 1. I allocated an array of pointer. 2. I Read line by line from a text file. 3. I allocated memory for the read line.
5
9937
by: Neil | last post by:
I am getting time-out errors when I try to perform a simple delete on a linked server. The command is: Delete From MyTable Where PKID=12345 I have tried executing this command directly from Query Analyzer, but it just times out. However, when I run it from QA against the server itself (rather than from my local server against a linked server), it executes immediately. Similarly, if I run the same SQL command through an ODBC linked...
5
3112
by: rn5a | last post by:
The .NET 2.0 documentation states the following: When using a DataSet or DataTable in conjunction with a DataAdapter & a relational data source, use the Delete method of the DataRow to remove the row. The Delete method marks the row as Deleted in the DataSet or DataTable but does not remove it. Instead when the DataAdapter encounters a row marked as Deleted, it executes its DeleteCommand method to delete the row at the data source. The...
7
15660
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
2
19754
by: Francesco Pietra | last post by:
Please, how to adapt the following script (to delete blank lines) to delete lines containing a specific word, or words? f=open("output.pdb", "r") for line in f: line=line.rstrip() if line: print line f.close()
0
9590
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
9424
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
10223
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...
1
10000
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
9866
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
8879
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...
0
5310
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...
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.