🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.vbasic
2 messages
2 total messages Started by Grzegorz Piziak Mon, 03 Dec 2012 22:14
Problem ze zmodyfikowanym checkboxem..
#104933
Author: Grzegorz Piziak
Date: Mon, 03 Dec 2012 22:14
34 lines
2068 bytes
Witam,
dlaczego w poniższym otrzymuję błąd:

System.InvalidCastException: Nie można rzutować obiektu typu 'System.Windows.Forms.CheckBox' na typ 'statmbp.checkboxyn'.

W kodzie designera zmieniam tą linijkę:
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
na
Friend WithEvents CheckBox1 As CheckboxYN

W momencie startu programu otrzymuję powyższy błąd.

Public Class CheckboxYN
    Inherits System.Windows.Forms.CheckBox
    Public Property YesNo As String
        Get
            If Me.checked Then
                Return "Y"
            Else
                Return "N"
            End If
        End Get
        Set(value As String)
            If Me.Checked Then
                Me.Checked = True
            Else
                Me.Checked = False
            End If
        End Set
    End Property
End Class

Pozdrawiam,
Grzegorz.
Re: Problem ze zmodyfikowanym checkboxem..
#104934
Author: Grzegorz Piziak
Date: Mon, 03 Dec 2012 22:22
5 lines
1238 bytes
Bo trzeba jeszcze to zmienić:

Me.CheckBox1 = New System.Windows.Forms.CheckBox()

Dobranoc...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads