Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2003, 02:45 PM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trapping Delete in the Datagrid

When I am in the datagrid control and press delete, the entire row is deleted. However, I only want the contents of the cell to be deleted.

How can I trap the delete key and have it set the contents of that cell to null?

Thanks,

Joshua
 
Old June 25th, 2003, 01:49 AM
Authorized User
 
Join Date: Jun 2003
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to planeswalk
Default


Hi,

What exactly do you want to do when you click on the Delete button on a datagrid? Do you want to delete only a particular cell's contents or do you want to clear the contents of the entire row without deleting it?


Marlon
 
Old June 25th, 2003, 09:19 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would like to only clear the particular cell's contents.

Thanks,

Joshua
 
Old June 29th, 2003, 07:17 PM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could try using a SELECT button:

Datagrid1.SelectedItem.Cells(i).text = ""

i = the cell(s) you would like to empty in the selected row
 
Old July 2nd, 2003, 09:08 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I still have to trap the delete. Currently when I hit delete it deletes the row. I don't want that to happen. How can I disable or change this?

Thanks!

-Joshua
 
Old July 10th, 2003, 04:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

i have not done it.. however I would expect you should catch the delete event on the grid and then mark it as handled- thereby short circuiting the actual delete.


Hal Levy
NOT a Wiley/Wrox Employee- Got a job for me?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: Right-click to delete in a datagrid nabrusim VB.NET 2002/2003 Basics 1 November 4th, 2007 12:10 PM
how to delete from datagrid sumith ASP.NET 1.0 and 1.1 Basics 3 March 6th, 2007 01:04 AM
How to Update and Delete in Datagrid Through comma Rahul Gupta ASP.NET 1.x and 2.0 Application Design 1 September 30th, 2005 11:42 PM
checkbox in datagrid and delete saman VS.NET 2002/2003 2 May 21st, 2004 12:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.