I have 2 datagridview (later- dgView), textboxes and some buttons. Everything is bounded and connected with MS Access db.
The tables in db are related!!
1st dgView contains Name and Surname table.
2nd dgView contains Details.
Now, how can I disable a delete button when datagrid is empty. I'm using this code:
If SvjeIDTextBox.Text = "" Then
Button2.Enabled = False
Else
Button2.Enabled = True
End If
Let me explain:
The SvjeIDTextBox.Text is textbox with the number of selected row in datagridview (when user clicks into datagrid view, the number of current row /selected row/ is shown into that SvjeIDTextbox).
Why I want to enable/disable delete button:
When i delete everything in datagridview, then there is no data in dgView. When dgView is empty and I click "delete" button, it gives me an error.
I don't know how to fix this error, so I decided to disable button "delete" when nothing is in datagridview.
Funny thing, but, when I put the code into "delete" button and make an MouseHover event over the delete button or mousehover event for whole Form, code is working.
But, I'm not happy with it.
Please help.