Datagrid - add row (null) question ?

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

As we add a new row in datagrid, How can we make it not display (null) in
that blank new record ??
I search some newsgroup talk about .allownull = false.
But I am fail to use it , Any idea ?

Thanks
 
I dont know if this is possible or not, however, it is displaying the
correct representation of its value, so why would you want to change that ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
Thanks Cor,
So, During my form load, I will load the data in the datagrid programically
with a special datagridtablestyles ,
If I want to addrow without null value, That's mean I need to create another
new datagridtablestyles ?

Before I am using vfp as development tools, its datagrid won't show null
value as new row. I am afraid the end-user dislike and challenge and new
design of .net system.
 
Hi Agnes,

I gave you in my previous answer the answer when you want to be lazy and do
not want to make columns, this is much nicer of course with columns.

I hope this helps?

Cor

Private Sub Form7_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable("Agnes")
dt.Columns.Add("Cor")
For i As Integer = 0 To 4
Dim dr As DataRow = dt.NewRow
dr(0) = (i + 1).ToString
dt.Rows.Add(dr)
Next
Dim dv As New DataView(dt)
Me.DataGrid1.DataSource = dv
Dim ts As New DataGridTableStyle
ts.MappingName = "Agnes"
ts.GridColumnStyles.Add(New DataGridTextBoxColumn)
ts.GridColumnStyles.Item(0).MappingName = "Cor"
ts.GridColumnStyles.Item(0).HeaderText = "Ident"
ts.GridColumnStyles.Item(0).NullText = String.Empty
DataGrid1.TableStyles.Add(ts)
End Sub
///
 
Back
Top