Click here to Skip to main content
13,048,584 members (78,551 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I use 2010 and have a gadagrid with a tablestyle on it.
when I write value 0 in the grid, it reffer it as null. I need it to be 0.
Here is the code to create the datagridtextboxcolumn:
Function BuildTableStyle(ByVal tsTableStyle As DataGridTableStyle, _
 ByVal clColumn As DataGridTextBoxColumn, ByVal stMappingName As String, _
 ByVal stHeader As String, ByVal dWidth As Double, ByVal stNullText As String, _
 ByVal blnReadOnly As Boolean, ByVal stFormat As String, ByVal stFormName As String, _
 ByVal dgDataGrid As DataGrid) As DataGridTextBoxColumn
         With clColumn
             .MappingName = stMappingName
             If stDataBaseType = "ORA" Then
                 .HeaderText = DecodeHeb(clsDBORA.GetDynamicHeaders(strConnection, _
                 stFormName, stHeader, stLanguageId, dgDataGrid.Name))
             ElseIf stDataBaseType = "SQL" Then
                 .HeaderText = clsDBSQL.GetDynamicHeaders(strConnection, stFormName, _
                 stHeader, stLanguageId, dgDataGrid.Name)
             End If
             .Width = dWidth * dWidthChange
             .NullText = stNullText
             .ReadOnly = blnReadOnly
             .Format = stFormat
             If blnReadOnly = True Then
                 .TextBox.BackColor = System.Drawing.Color.White
             End If
         End With
         AddHandler clColumn.TextBox.KeyUp, AddressOf HandleKeyUp
         AddHandler clColumn.TextBox.KeyDown, AddressOf HandleKeyDown
         Return clColumn
     Catch ex As Exception
         Return clColumn
     End Try
 End Function

and here is the code that call this function:
Private Sub FillQueryParameters(ByRef dsQueryParameters As DataSet)
         dgParameters.HeaderFont = New System.Drawing.Font("Arial", 15.0F, _
         System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, _
         Dim tsParameters As New DataGridTableStyle
         stDataSetTable = dsQueryParameters.Tables.Item _
         tsParameters.MappingName = stDataSetTable
         Dim clRepParam As New DataGridTextBoxColumn
         clRepParam = BuildTableStyle(tsParameters, clRepParam, "rep_param_no", _
         "clRepParam", 0, "", True, "#0", Me.Name, dgParameters)
         Dim clScreenParam As New DataGridTextBoxColumn
         clScreenParam = BuildTableStyle(tsParameters, clScreenParam, _
         "screen_param_no", "clScreenParam", 30, "", True, "#0", Me.Name, dgParameters)
         Dim clParamName As New DataGridTextBoxColumn
         clParamName = BuildTableStyle(tsParameters, clParamName, "param_name", _
         "clParamName", 150, "", True, "", Me.Name, dgParameters)
         Dim clParamType As New DataGridTextBoxColumn
         clParamType = BuildTableStyle(tsParameters, clParamType, "param_type", _
         "clParamType", 150, "", True, "", Me.Name, dgParameters)
         Dim clParamValue As New DataGridTextBoxColumn
         clParamValue = BuildTableStyle(tsParameters, clParamValue, "param_value", _
         "clParamValue", 100, 0, False, "#0", Me.Name, dgParameters)
         Dim clParameterName As New DataGridTextBoxColumn
         clParameterName = BuildTableStyle(tsParameters, clParameterName, "parameter_name", _
         "clParameterName", 0, "", False, "", Me.Name, dgParameters)
         dgParameters.SetDataBinding(dsQueryParameters, "rep_param")
         Dim cmCurrencyManager As CurrencyManager = DirectCast(Me.BindingContext _
         (dgParameters.DataSource, dgParameters.DataMember), CurrencyManager)
         DirectCast(cmCurrencyManager.List, DataView).AllowNew = False
     Catch ex As Exception
     End Try
 End Sub

Can anyone help please?
Thank you
Posted 22-Sep-12 6:04am
Updated 22-Sep-12 10:31am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Looks like OP resolved it by himself. Posting this just to pop it out of unanswered list.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100