DatagridView HowToDo?
I have a column in the grid which has coded Data, 0 or 1 which shall be displayed as "Deactive" for a 0 and "Active" for a 1. Is this possible to do?
The application is VB2005 Express and Windows Forms
Thanks
Manfred
I have a column in the grid which has coded Data, 0 or 1 which shall be displayed as "Deactive" for a 0 and "Active" for a 1. Is this possible to do?
The application is VB2005 Express and Windows Forms
Thanks
Manfred
Use the datagridview's cellformatting event for that.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dt As New DataTable("Names") dt.Columns.Add("Name") dt.Columns.Add("State") dt.Columns.Add("Active") dt.LoadDataRow(New Object() {"Ken Tucker", "Florida", "0"}, True) dt.LoadDataRow(New Object() {"Cor Ligthert", "Netherlands", "1"}, True) dt.LoadDataRow(New Object() {"Terry Burns", "United Kingdom", "1"}, True) dt.LoadDataRow(New Object() {"Armin Zignler", "Germany", "1"}, True) dt.LoadDataRow(New Object() {"Herfried K. Wagner", "Austria", "1"}, True) dt.LoadDataRow(New Object() {"Jay B Harlow", "New York", "0"}, True) DataGridView1.DataSource = dt DataGridView1.AllowUserToAddRows = False End Sub Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting |