Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
How to set Particular cell value to Empty in Vb.net 2010?
posted

For Example:

  ultragrid.Rows(i).Cells(0).Value = DBNull.Value

or

  ultragrid.Rows(i).Cells(0).Value = Nothing

--

From the above, Which will u recommend to use it?

                    If i set 'Nothing'  then it creating Exception for the first row of the grid. For the other rows it works fine.

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    The System.Data.DataColumn class exposes an AllowDBNull property which determines whether that column supports null values. If you are bound to a DataTable, your problem is most likely related to this.

    'Nothing' is the VB equivalent to null in C#, and is different from DBNull.Value. Again, if you are bound to a DataTable you usually use DBNull.Value as opposed to null.

    Note that UltraGridColumn exposes a Nullable property which determines how the grid interprets the act of clearing a cell's value.

Children
No Data