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 4607956
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:46:34+00:00 2026-05-22T00:46:34+00:00

i asked this question previously in vb.net but i want to do it in

  • 0

i asked this question previously in vb.net but i want to do it in c#..

Private Sub cbtns_ClickButtonArea(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cbtn_a.ClickButtonArea, cbtn_b.ClickButtonArea, cbtn_c.ClickButtonArea, cbtn_d.ClickButtonArea
Dim cbtn As CButtonLib.CButton() = {cbtn_a, cbtn_b, cbtn_c, cbtn_d}        
Dim clickedBtn As CButtonLib.CButton = DirectCast(sender, CButtonLib.CButton)

For Each cb As CButtonLib.CButton In cbtn
    If cb Is clickedBtn Then
        cb.Enabled = False
    Else
        cb.Enabled = True
    End If
Next        
End Sub

how to convert this to c#?

  • 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-22T00:46:35+00:00Added an answer on May 22, 2026 at 12:46 am

    Something like this

    private void cbtns_ClickButtonArea(System.Object Sender, System.Windows.Forms.MouseEventArgs e)
    {
        CButtonLib.CButton[] cbtn = {
            cbtn_a,
            cbtn_b,
            cbtn_c,
            cbtn_d
        };
        CButtonLib.CButton clickedBtn = (CButtonLib.CButton)sender;
    
        foreach (CButtonLib.CButton cb in cbtn) {
            if (cb == clickedBtn)) {
                cb.Enabled = false;
            } else {
                cb.Enabled = true;
            }
        }
    }
    

    and

    cbtn_a.ClickButtonArea += cbtns_ClickButtonArea;
    cbtn_b.ClickButtonArea += cbtns_ClickButtonArea;
    cbtn_c.ClickButtonArea += cbtns_ClickButtonArea;
    cbtn_d.ClickButtonArea += cbtns_ClickButtonArea;
    

    Since c# does not have and equivalent to Handles, the event handlers have to be added like it’s shown above.

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

Sidebar

Related Questions

I previously asked this question on the Facebook forums but apparently they want us
RESOLVED: CSS Animation/Scale issue in Chrome/Webkit I asked this question previously, but I'm not
I asked this question previously and thought I had it figured out but it
I asked a question related to this one previously but I need to know
I asked this question previously: Disabling and Re-Enabling Dynamic Form Elements with JQuery but
I have seen this question asked previously but can not find a clear explanation
I asked this question previously but the answers weren't what I was looking for.
I asked this question previously but i think i made it too complex, I
I know this question was asked previously and the reply was to override onPrepareContextMenu()/onCreateContextMenu().
This is an extension of a question I previously asked here . Long story

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.