473,394 Members | 2,052 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,394 software developers and data experts.

How do i add a delete button to a datagrid in a windows application?

i am building a windows form application.
i have a datagrid that's showin al the rows.
i haev the update and add buttons separately.. but i want a delete button embedded inside each row at the end.

Help!
Jul 12 '10 #1
2 1938
GaryTexmo
1,501 Expert 1GB
I don't know that you can... I think the DataGrid control is self-contained, you might not be able to.

That said, you could look into making a custom control and overriding the paint event (if you can) in order to place buttons in the location you want. This wouldn't really be a trivial thing and would certainly take some doing.

Google for creating user controls in C# and overriding the paint event for more information.
Jul 12 '10 #2
TextBox and Bool columns can be embed in DataGrid directly from the classes provided by "DataGridTextBoxColumn" class and "DataGridBoolColumn"
class respectively from the .net library classes.

To get the Button column in a DataGrid you have to write your own class by subclassing the abstract "DataGridColumnStyle" like

public class DataGridTextBoxColumn : DataGridColumnStyle

and you must implement atleast 8 methods,,

for more information visit

http://msdn.microsoft.com/en-us/library/ms996453.aspx


/////////////
this answer is upto my knowledge..please excuse for any mistakes made....
Jul 21 '10 #3

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

Similar topics

5
by: Jean Carlo | last post by:
Hello guys I`m developing a windows form that contain one Datagrid. In this datagrid I insert a checkBox Column. I need to get all rows where checkbox is checked by user. How do I get this...
4
by: Elliot M. Rodriguez | last post by:
I have a Delete button in my datagrid. I'm attempting to add some code confirming whether the user wishes to really delete the item or not. The confirm pops up, but I cannot suppress the...
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
3
by: Trond | last post by:
I added a delete button to a datagrid. I also added an event: private void dgMessages_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) I added this to event: ...
2
by: Andy Sutorius via DotNetMonster.com | last post by:
Hi, I have a delete button in the item template of my datagrid, when I click it the function for the Insert button is executed instead of the delete button. When I step through in debug, the...
3
by: mohamed farouk | last post by:
hi everyone i have a database on sql server that contain the name and the telephne number ,i have a combo box that contain the names i want to put button so when i click on it open port in the...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
5
by: AishaKhalfan | last post by:
Hi all, I am doing a Library Management System by using VB2005. Net. I’m facing a problem which is deleting record from grid view. The application is Windows based. I have delete button and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
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
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...

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.