If you click on Complete on the datagridview on one of the rows being displayed the row disappears. Well, almost. It disappears after you click on another row. What property do I need to set to cause it to disappear immediately? I tried EditOnEnter and that didn't work.
If you click on Complete on the datagridview on one of the rows being displayed the row disappears. Well, almost. It disappears after you click on another row. What property do I need to set to cause it to disappear immediately? I tried EditOnEnter and that didn't work.
I actually demo'd that for you in another of your recent post.
So what does not work? I am going to be blunt about this, I created the VS2008 project on a Vista machine at home and uploaded it to you then this morning at work downloaded the project I sent you and opened it in VS2010, ran it after conversion and it worked the same as when I created it in VS2008. Next I went one step farther and upgraded to Framework 4, built and ran the project which ran no different than the first version I gave you. So when you say it does not work a) that is extremely vague b) tells me you have not tried very hard to get it to work. With that said how do you expect others to assist you when you (from my view point) are not taking steps to learn from what is given to you.
The attachment as mentioned above is the same other than converting to VS2010 via VS2010 upgrading, Framework 4 and a few lines where I broke lines down with no underscore. So again you have another working copy of the VS2008 project which shows the behavior you are questioning in regards to disappearing rows.
You can handle the DataGridView.CellContentClick event and test the column of the cell to see if it's the "Complete" column. If it is, you set the datagridview.currentcell to nothing.
Code:
Private Sub DataGridView1_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim colName As String = DataGridView1.Columns(e.ColumnIndex).HeaderText
If colName = "Complete" Then
DataGridView1.CurrentCell = Nothing
End If
End Sub
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it. - Abraham Lincoln -
kevininstructor, When the datagridview is filtered on false and you click Action on, then I want the row to disappear at that time instead of after one subsequent click. On your example the row does not disappear on click. Unless I'm doing something wrong.
kevininstructor, When the datagridview is filtered on false and you click Action on, then I want the row to disappear at that time instead of after one subsequent click. On your example the row does not disappear on click. Unless I'm doing something wrong.
My intent was to show you the behavior only not to make the row disappear as Stan has shown you. Why I was reacting to your second reply was that you said my project did not work which I interept as the project would not run. If you had said the project runs but give you results different than you were looking for then that is a whole different beast.
So by applying Stan's method to my project as shown below, yes that gives you the results you want w/o checking the behavior checkbox.
Code:
Private Sub DataGridView1_CellContentClick( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim colName As String = DataGridView1.Columns(e.ColumnIndex).HeaderText
If TypeOf DataGridView1.Columns(e.ColumnIndex) Is DataGridViewLinkColumn AndAlso Not e.RowIndex = -1 Then
Process.Start(DataGridView1.Item(e.ColumnIndex, e.RowIndex).Value.ToString())
ElseIf colName = "Action" Then
DataGridView1.CurrentCell = Nothing
End If
End Sub
Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
BindingSource1.EndEdit()
DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
End Sub
stanav, Why would I want to set the cell to nothing?
Yes, originally I could not get the VB2008 project to open.
That is strange, I could open it on two different computers other than the computer used to create the project.
Note I suffle between two xp and one vista box, none had issues opening the project. Perhaps it has something to do (if you are) with you using VS Express edition?
Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
BindingSource1.EndEdit()
DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
End Sub
stanav, Why would I want to set the cell to nothing?
Because when you click on a cell, it becomes the current cell. However, when the current row disappears as you want it to, the current cell is no longer valid. Setting it to Nothing forces the currentcellchanged event to be raised, which causes the datagridview to commit edit (the same effect you have when you click somewhere else out of the cell). Besides, it prevents the DGV to set another cell as the current cell on its own, which might or might not be what you want. When I go to a store to buy something, if that something suddenly becomes unavailable, I'd rather walk home empty handed than let the sales clerk stuffs something else into my bag as a replacement. That's just me
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it. - Abraham Lincoln -