Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one problem
How i make a button visible or Un Visible using the DataGridView's Checkbox....
Please any one help me......?

i used a v s 2008 (windows Form)
Posted

On checkedchanged event of that checkbox write code like
buttonname.visible = true -- To make button visible
buttonname.visible = false -- TO make button invisible
 
Share this answer
 
Comments
Neeil 8-Dec-10 6:17am    
@ manoj from pune......ok , but how can i write that is useful hen i make checkd a checkbox of datagridview......and imlies it a button make visible
Manoj from Pune 8-Dec-10 6:37am    
Please be claer.. M not getting nything from ur commment
Neeil 8-Dec-10 6:49am    
when i change a checkbox to check in the datagridview.....the button is visible other-wise unvisible.......Can u give me code...
Manoj from Pune 8-Dec-10 7:01am    
Private Sub checkbox_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkbox.CheckedChanged
if checkbox.checked = true then
button.visible = true
else if checkbox.checked = false then
button.visible = false
End Sub
Hi Neeil,

You can set visible a column if button in the grid.

dgvTest.Columns("Column").Visible = True

alternate if you want to visible a button on form then,

on cell content click event of grid code like this . I am giving only steps.

1. check e.colimnindex and e. rowindex greater than -1.
2. check if it is desired column or not.
3. then check check box is checked or not.

If e.RowIndex <> -1 Then
If e.ColumnIndex <> -1 Then
If dgvTest.Columns(e.ColumnIndex).Name = "testcolumn" Then
if Convert.ToBoolen(dgvTest(e.RowIndex)(e.ColumnIndex).Value) = Ture Then
btntest.visible= True
Else
btntest.visible= False

EndIF
EndIF
EndIF
 
Share this answer
 
v2
Comments
Neeil 8-Dec-10 6:18am    
@ vivekse......ok , but how can i write that is useful hen i make checkd a checkbox of datagridview......and imlies it a button make visible

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900