|
-
Feb 21st, 2008, 09:14 AM
#1
Thread Starter
Addicted Member
Datagrid row delete
Hello guys,
I want to delete a particular row which is selected in the datagrid(ie datagrid.text row will be delete)....
How to do? Advance thanks
-
Feb 21st, 2008, 09:38 AM
#2
Re: Datagrid row delete
Try this:
Code:
Private Sub Command4_Click()
If MsgBox("Are you sure", vbQuestion + vbYesNo, "Confirm Delete") = vbYes Then
Adodc1.Recordset.Delete adAffectCurrent
Adodc1.Recordset.Requery
Adodc1.Refresh
DataGrid1.Refresh
End If
End Sub
-
Feb 21st, 2008, 09:54 AM
#3
Re: Datagrid row delete
In other words, don't delete the record from the grid. Delete it from the underlaying datasource, i.e., your database, and then refresh the grid.
-
Feb 21st, 2008, 10:25 AM
#4
Re: Datagrid row delete
 Originally Posted by Hack
In other words, don't delete the record from the grid. Delete it from the underlaying datasource, i.e., your database, and then refresh the grid.
... or better yet don't use any databound controls at all and no data control either.
MsFlexgrid and ADO library can be much more better choice.
-
Feb 21st, 2008, 10:52 AM
#5
Thread Starter
Addicted Member
Re: Datagrid row delete
First Thanks for your reply guys...
Still i didn't get...
I am using the ADODB.connection for recordset ie. Dim r As ADODB.Recordset
for adding i am using r.fields("File name")=string
I am using the datagrid for display the recordset... Now i want to delete the "datagrid1.text" row completly..... What to do :confused?
-
Feb 21st, 2008, 10:55 AM
#6
Re: Datagrid row delete
 Originally Posted by kpmsivachand
What to do :confused?
This
 Originally Posted by RhinoBull
MsFlexgrid and ADO library can be much more better choice.
Or, I'm a fan of the Listview.
-
Feb 21st, 2008, 10:59 AM
#7
Thread Starter
Addicted Member
Re: Datagrid row delete
 Originally Posted by Hack
ThisOr, I'm a fan of the Listview.
I cann't get u?
-
Feb 21st, 2008, 11:01 AM
#8
Re: Datagrid row delete
As RhinoBull suggested, don't use the DataGrid. It is a bound control which by its very nature, is limiting in how it can be manipulated.
Switch to a FlexGrid (his control of choice) or a ListView (my control of choice) and load the control of your choice from a recordset that you create based on an SQL query.
-
Feb 21st, 2008, 11:01 AM
#9
Re: Datagrid row delete
Your Datagird is BOUND to a Recordset object - you cannot just delete line from the grid without actually deleting it first from the underlying recordset.
If you are not using data control then get rid of Adodc1 in my sample.
-
Feb 21st, 2008, 11:08 AM
#10
Thread Starter
Addicted Member
Re: Datagrid row delete
 Originally Posted by Hack
Switch to a FlexGrid (his control of choice) or a ListView (my control of choice)
Ok i will try using the flexgrid.... But in the listview, can we make the mulitiple coloumns in a single row?
-
Feb 21st, 2008, 11:59 AM
#11
Re: Datagrid row delete
 Originally Posted by kpmsivachand
But in the listview, can we make the mulitiple coloumns in a single row?
You betcha
-
Feb 21st, 2008, 12:07 PM
#12
Addicted Member
Re: Datagrid row delete
Hack, is that everything we do with FlexGrid or most of the feature of FlexGrid is handled using ListView? If possible can you suggest me a sample please.. I am in eager to use the alternative controls for list of Information. Thanks....
Regards
Srinivasan Baskaran
India
-
Feb 21st, 2008, 12:36 PM
#13
Re: Datagrid row delete
I haven't used a FlexGrid is so long, I'm can't remember exactly what it does do. However, if you are interested in exploring either the FlexGrid or the ListView, then I would ask that you create your own thread for this topic.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|