Datagrid help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hopefully someone out there can help me. I am using a windows forms datagid
to edit a dataset. The datagrid seems to work fine transfering data back and
forth, but I need to format the user input and I can not figure out how.
Does any one know how I can remove the "(null)" from a new cell in the
datagrid and how to force all user input to uppercase? Any help would be
greatly appreciated.

Chris
 
I can give you the VB style, but it should be adequate to understand
what's needed. The same thing applies, you'll just need the C# syntax:
Notice the NullText property.

Dim tStyle As DataGridTableStyle
Dim bCol As DataGridBoolColumn
Dim tCol As DataGridTextBoxColumn

grdAnnouncements.DataSource = dvAnn

tStyle = New DataGridTableStyle
tStyle.MappingName = "ann"

tCol = New DataGridTextBoxColumn
tCol.Width = 0
tCol.NullText = ""
tCol.HeaderText = ""
tCol.MappingName = "annid"
tCol.ReadOnly = True
tStyle.GridColumnStyles.Add(tCol)

tCol = New DataGridTextBoxColumn
tCol.Width = 85
tCol.NullText = ""
tCol.HeaderText = "File Name"
tCol.MappingName = "filename"
tCol.ReadOnly = True
tStyle.GridColumnStyles.Add(tCol)

grdAnnouncements.TableStyles.Add(tStyle)
 
Back
Top