locked
Issue - convert 0 to Nothing in VB RRS feed

  • Question

  • User1722694416 posted

    Hi

    I have a project where i am using dropdown to select the value but when user select the value 0 and assign this value to property then value convert to 0 to nothing.

    for e.g.

    oIncidentBase.riddorreported = drRIDDOR.SelectedItem.Value // here drriddor value is 0

    //property where values assigned

    Dim i_riddorreported As Integer
    Public Property riddorreported() As Integer
    Get
    Return i_riddorreported
    End Get
    Set(ByVal value As Integer)
    i_riddorreported = value
    End Set
    End Property

    If i_riddorreported <> Nothing Then // Here this condition became false and code in if condition is not executing.

    ' Dim paramriddorreported As New SqlParameter("@RIDDORReported", SqlDbType.Int)
    ' paramriddorreported.Value = i_riddorreported
    ' oParams.Add(paramriddorreported)
    End If

    In database storing the default value

    Can somebody help me on this how i can store 0 if user select No in database.

    Thanks in Advance

    Monday, January 13, 2014 4:13 AM

Answers

  • User1722694416 posted

    solved. remove if condition now correct value is going in the database.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 13, 2014 4:48 AM

All replies