We help IT Professionals succeed at work.

Lock a row in a datagrid ( not mshflexgrid or msflexgrid)

mindserve asked
Last Modified: 2013-12-25
I have a datagrid on a form. I would like to be able to lock certain rows across. For example, These rows are associated with client tickets. Because it is not locked nor does it remain locked after the ticket is closed the user can accidentally re-open a ticket. The word Closed goes on the grid to notify them that the ticket is closed, but if they are not observant, it's too easy for them to re-open an old ticket and again add to that ticket. Any ideas? This is VB6
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)


The user clicks on a button on the POS screen which is on a second tab and then on the first tab there is a grid. On the grid there is a cell that says "Closed"
So basically all I need to figure out is how to lock the cell for most users and unlock for a manager. There are manager level permissions. But I can't get it to lock when the form loads, for some reason all the cells lock up on the grid.
This is what I have right now: See Code snippet.

The problem is that it locks only when the user clicks the button in the cell. I can't seem to find a way to lock it when the user just clicks on that cell. Or unlock if they have the right permissions. I have tried, gotfocus, click, keypress, validate...on and on...

I know it's possible, I am just not sure of where this code block belongs.

Private Sub grdtickets_ButtonClick(ByVal ColIndex As Integer)
 With grdTickets.Columns(ColIndex)
If ValidateUser(CurrentUser.Username, CurrentUser.Userpass).AccessLevel(34) = False Then
MsgBox "Only a Manager re-open a ticket. Tickets are closed from the POS screen.", vbCritical + vbOKOnly, "Warning!"
grdTickets.Columns(2).Locked = True
End If
End If
End With
End Sub

Open in new window

Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.