I have a datagridview with some writable columns and some non-writable columns. I would like to format the values in the writable columns/cells, when I type in a value in theese cells.
I need values like "0.0 nm", and "000.0"
How can I format the writable columns?
For information, these values is used for calculations to the non-writable cells.
The datagridview is unbound.
Hope someone can give me a little help, Thanks.
I use VS 2010, and VB.net.

this code will help:

Me.DataGridView1.Rows.Add("a", "100", "20", "")
        Me.DataGridView1.Rows.Add("b", "200", "30", "")
        Me.DataGridView1.Rows.Add("c", "300", "40", "")
        Me.DataGridView1.Rows.Add("d", "400", "50", "")

        'row 1 now is read only - others are editable
        Me.DataGridView1.Rows(0).ReadOnly = True

        Me.DataGridView1.Rows(0).DefaultCellStyle.ForeColor = Color.DarkBlue
        Me.DataGridView1.Rows(0).DefaultCellStyle.BackColor = Color.Crimson


        Me.DataGridView1.Rows(2).DefaultCellStyle.ForeColor = Color.DarkBlue
        Me.DataGridView1.Rows(2).DefaultCellStyle.BackColor = Color.Crimson
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.