473,782 Members | 2,699 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 1931


"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
It seems that you might be able to pipe in the selected rows into an array first.

You would then of course have to modifiy the output of the message box to
show all the selected id's that cannot be deleted.
Mar 6 '06 #2

"Sirrius" <Si*****@discus sions.microsoft .com> дÈëÓʼþ
news:4D******** *************** ***********@mic rosoft.com...


"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
It seems that you might be able to pipe in the selected rows into an
array first. You would then of course have to modifiy the output of the message box to
show all the selected id's that cannot be deleted.


private void dt_RowDeleted() will be triggered multiple times, once per row.

I Suppose each time triggered on different row, but seems to me, always on
the same row.

So I think it is not about modify output of the message box.

Thanks,
Ryan
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
14898
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
1240
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
1164
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
2484
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...
3
3812
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get anything to work. I know this is probably simple for more experienced Access users. Any help would be greatly appreciated. Thanks Kevin
7
15661
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
10143
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...
1
10076
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
8964
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...
1
7486
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 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...
0
6729
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
5375
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...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
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
3
2870
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.