I have what I believe to be a simple unbound datagridview in a VB 2005 Beta 2 windows application. The issue is that I can not get numeric data to be formatted in the cells as "12,345" instead of "12345". Does anyone know what is wrong with the following code (this is the entire set of code in the project) - I must be missing something pretty simple. The grid is the only control on the form. Specifically the statement <columnStyleR.Format =
"#,##0"> does not seem to work.
Thanks!
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dgvA.AllowUserToAddRows =
False dgvA.AllowUserToDeleteRows =
False dgvA.AllowUserToOrderColumns =
True dgvA.ReadOnly =
True dgvA.RowHeadersVisible =
False dgvA.ColumnHeadersVisible =
True dgvA.SelectionMode = DataGridViewSelectionMode.FullRowSelect
dgvA.MultiSelect =
True dgvA.ColumnCount = 2
Dim columnStyleR As New DataGridViewCellStyle() columnStyleR.BackColor = Color.Yellow
columnStyleR.Alignment = DataGridViewContentAlignment.TopRight
columnStyleR.Format =
"#,##0" dgvA.Columns(0).Name =
"Index#" dgvA.Columns(0).HeaderText =
"Index#" dgvA.Columns(0).MinimumWidth = 25
dgvA.Columns(0).Width = 40
dgvA.Columns(0).DefaultCellStyle = columnStyleR
dgvA.Columns(1).Name =
"Size" dgvA.Columns(1).HeaderText =
"Size" dgvA.Columns(1).MinimumWidth = 50
dgvA.Columns(1).Width = 75
dgvA.Columns(1).DefaultCellStyle = columnStyleR
Dim row0 As String() = {1, 12345} Dim row1 As String() = {2, -12345} Dim row2 As String() = {3, 1234.567} dgvA.Rows.Add(row0)
dgvA.Rows.Add(row1)
dgvA.Rows.Add(row2)
End Sub