Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button in grid sometimes
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
Button in grid sometimes
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01349499
Message ID:
01349499
Views:
59
I have a Datagrid where I would like to have a button show if a field has a value and not show if no value is present.

I currently change the button's caption with the code below.
  Private Sub Con_campDataGridView_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles Con_campDataGridView.CellFormatting

        Dim i As Integer
        i = Me.Con_campDataGridView.Columns("file_loc").Index

        If e.ColumnIndex = i And e.RowIndex > -1 Then
            e.FormattingApplied = True
            If IsDBNull(e.Value) Or e.Value Is Nothing Then
                e.Value = ""
                ' I would like to hide the button if not file is available

            Else
                e.Value = "Show Image"
            End If
        End If

    End Sub
Next
Reply
Map
View

Click here to load this message in the networking platform