I am creating a custom button control and have difficulty with my Text property. All that I type, remains only when you open the form designer window. When I close the form designer and open it again, the Text property changes the value to "". Also, if I run the program, it loses the value entered during development.
I also have an Image property for my control, which works fine.
Here are some of my codes:
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Windows.Forms
Imports System.ComponentModel
Public Class BlackButton
Private iText As String
Private iImage As Image
''' <summary>
''' Gets/Sets the text displayed in the button.
''' </summary>
<Browsable(True), Description("Gets or sets the text displayed on the button")> _
Public Shadows Property Text() As String
Get
Return iText
End Get
Set(ByVal value As String)
iText = value
ReDrawMe()
End Set
End Property
''' <summary>
''' Gets/Sets the image to be displayed on the button
''' </summary>
<Browsable(True), Description("Gets or sets the image displayed on the button")> _
Public Shadows Property Image() As Image
Get
Return iImage
End Get
Set(ByVal value As Image)
iImage = value
ReDrawMe()
End Set
End Property
I carefully combed my code and made sure that I did not restart it anywhere.
Thanks in advance for your help.
source
share