473,378 Members | 1,152 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to delete multi rows in datagridview in c#

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 1806
Frinavale
9,735 Expert Mod 8TB
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
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
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
by: newbie | last post by:
Dear folks, pardon me if this is a stupid question. For this table --------------------------------------- | id | foo | bar | -------------------------------------- I...
2
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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.