dimanche 2 juillet 2017

Exception - Object reference not set to an instance of an object.

I'm trying to format the text of checkbox but i get 'Object reference not set to an instance of an object.' exception. Any idea?

    Dim i As Decimal = 0
    Dim Cb As CheckBox
    Dim tr As Control
    Dim td As Control
    Dim cont As New Control



    For Each tr In TableSfarimNosafim.Controls
        For Each td In tr.Controls
            For Each cont In td.Controls
                'Cb = DirectCast(cont, CheckBox)
                Cb = TryCast(cont, CheckBox)
                Cb.Text = clsTargumKodim.SfarimNosafim(i)
                i = i + 1
            Next
        Next
    Next

THANKS :)




Aucun commentaire:

Enregistrer un commentaire