a problem in datagridview

Tech-Archive recommends: Fix windows errors by optimizing your registry



i am using a DataGridView control to populate data from database.
it has a checkbox column for selecting and some other textbox columns
for showing the data.

the form also has a toolstrip which has a button for viewing print
preview of selected rows. when the user selects or deselects a row
then the preview button visiblity changes depending upon whether one
or more rows are checked.

i created the procedure for it as following:
--------------------------------------------------------------------------------------------------
Public Sub TogglePrintPreview()

Dim flagPreview As Boolean = False
For i As Integer = 0 To dgSwitchInv.Rows.Count - 1
If
Convert.ToBoolean(dgSwitchInv.Rows(i).Cells(0).EditedFormattedValue) =
True Then
flagPreview = True
End If
Next

ActiveDirectory.HideButton(Me.Name, btnPreview, flagPreview)


End Sub
--------------------------------------------------------------------------------------------------

but the preview button does not change its visiblity everytime
am i doing something wrong here. or is there a better solution for
this.

.


Quantcast