Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 652287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:15:22+00:00 2026-05-13T22:15:22+00:00

I’ve created a custom control which consists of two radio buttons with their appearance

  • 0

I’ve created a custom control which consists of two radio buttons with their appearance set to “Button”. This control is meant to act like two toggle buttons with an “On” toggle button and an “Off” toggle button. I have a public boolean property “isAOn” which is used to set the state of both buttons and I want to be able to bind this property to boolean values. I have imported the component model and set

Now when I add this to a form for a boolean value in one of my classes it doesn’t seem to update the boolean value of the class when I change the button pressed.

Advice on how to resolve this issue and constructive criticism on class design is more than welcome.

Thanks!

Here is the code:

Imports System.ComponentModel

''#
<DefaultBindingProperty("isAOn")> _
Public Class ToggleButtons

    Private _isAOn As Boolean
    Private _aText As String
    Private _bText As String
    Private _aOnColor As Color
    Private _aOffColor As Color
    Private _bOnColor As Color
    Private _bOffColor As Color

    Public Sub New()

        ''# This call is required by the Windows Form Designer.
        InitializeComponent()

        ''# Add any initialization after the InitializeComponent() call.
        aOffColor = Color.LightGreen
        aOnColor = Color.DarkGreen
        bOffColor = Color.FromArgb(255, 192, 192)
        bOnColor = Color.Maroon
        isAOn = False
        aText = "A"
        bText = "B"
    End Sub

    Private Sub configButtons()
        If _isAOn Then
            rbA.Checked = True
            rbA.BackColor = _aOnColor
            rbB.Checked = False
            rbB.BackColor = _bOffColor
        Else
            rbA.Checked = False
            rbA.BackColor = _aOffColor
            rbB.Checked = True
            rbB.BackColor = _bOnColor
        End If
        rbA.Text = aText
        rbB.Text = bText
    End Sub

    Public Property isAOn() As Boolean
        Get
            Return _isAOn
        End Get
        Set(ByVal value As Boolean)
            _isAOn = value
            configButtons()

        End Set
    End Property

    Private Sub rbOn_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbA.CheckedChanged
        isAOn = rbA.Checked
    End Sub

    Private Sub rbOff_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbB.CheckedChanged
        isAOn = Not rbB.Checked
    End Sub

    Public Property aText() As String
        Get
            Return _aText
        End Get
        Set(ByVal value As String)
            _aText = value
        End Set
    End Property
    Public Property bText() As String
        Get
            Return _bText
        End Get
        Set(ByVal value As String)
            _bText = value
        End Set
    End Property
    Public Property aOnColor() As Color
        Get
            Return _aOnColor
        End Get
        Set(ByVal value As Color)
            _aOnColor = value
        End Set
    End Property
    Public Property aOffColor() As Color
        Get
            Return _aOffColor
        End Get
        Set(ByVal value As Color)
            _aOffColor = value
        End Set
    End Property
    Public Property bOnColor() As Color
        Get
            Return _bOnColor
        End Get
        Set(ByVal value As Color)
            _bOnColor = value
        End Set
    End Property
    Public Property bOffColor() As Color
        Get
            Return _bOffColor
        End Get
        Set(ByVal value As Color)
            _bOffColor = value
        End Set
    End Property

End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:15:22+00:00Added an answer on May 13, 2026 at 10:15 pm

    You need to add an isAOnChanged event and raise it in the property setter.

    By the way, properties and methods in .Net should be UpperCamelCased.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to run a str_replace or preg_replace which looks for certain words
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.