473,513 Members | 3,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to delete multi rows in datagridview in c#

3 New Member
hi
I delete rows in datagridview using chcekbox column
I write the following code

Expand|Select|Wrap|Line Numbers
  1. private void btndelpay_Click(object sender, EventArgs e)
  2. {
  3. DialogResult dr = MessageBox.Show("delete row", "do you want to delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
  4. if (dr == DialogResult.Yes)
  5. {
  6. DataGridViewRow row = new DataGridViewRow();
  7. for (int i = 0; i < gridviewimppays.Rows.Count; i++)
  8. {
  9. row = gridviewimppays.Rows[i];
  10. if (Convert.ToBoolean(row.Cells[0].Value) == true)
  11. {
  12. if (ImprestsPaysMgr.DeleteImprestsPays(int.Parse(row.Cells["ID"].Value.ToString())))
  13. gridviewimppays.Rows.Remove(row);
  14. i--;
  15. }
my prolblem is
how to umcheck from rows in datagridview in chechboxes column when the user select dialogResult.NO
Sep 14 '14 #1
1 1812
Frinavale
9,735 Recognized Expert Moderator Expert
What type of application is this?
Web, WinForms, WPF...?
Sep 16 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
11780
by: Bob Ganger | last post by:
Hello, I am working on a project using SQL Server 2000 with a database containing about 10 related tables with a lot of columns containing text. The total current size of the database is about...
5
24501
by: jeff | last post by:
i am using ms access as my database i can successfully delete a single record from a table using : targetRow.Delete() Try reportDataAdapter.Update(reportDataSet, "table1" )...
2
2656
by: newbie | last post by:
Dear folks, pardon me if this is a stupid question. For this table --------------------------------------- | id | foo | bar | -------------------------------------- I...
2
3300
by: =?Utf-8?B?TU1TSkVE?= | last post by:
How to let user delete multi rows from the BindingSource I have in my program datagridview bound it to sql table Throw Bindingsource To fill it: MyTableTableAdaptor.fill(MyDataset.Mytable); ...
3
3087
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
2
5322
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
0
1269
by: sudha 123 | last post by:
I am having Lsit object to fill my datagridview but after fill grid with obj if there is any new entry in data means that will reflect in my grid view because i am using refesh button as well as...
3
2864
by: huynhtienlinh | last post by:
I'm trying to save multi line values in textbox into multi rows in sql. I have a textbox as shown in below image http://www.4shared.com/photo/91DD7knd/Multi-textbox.html After save, I want in...
0
7153
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
7373
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,...
0
7432
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...
1
7094
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
5677
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
5079
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
3230
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
1585
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 ...
0
452
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...

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.