❔ ComboBox event help

I'm currently making a Voting System for a school project and here's something I wanted to make for my own So I wanted to be able to select the number of candidates in this form, make the unneeded options based on the selection automatically turn into "N/A" and make them unable to be edited. Thanks in advance!
No description
10 Replies
Buddy
Buddy14mo ago
$ask
MODiX
MODiX14mo ago
How to get the best help catpog Make a post in #help or one of the topic channels under Development. Avoid askingcatthinking Can anybody help catthinking Has anyone used catthinking Why doesn't my code work? C# is a big area! No one knows they can help unless you tell them about the small area you're trying to work in. Explain what you are doing, and potentially why for as much context as possible. Avoid screenshots where possible, share code directly in Discord. Type $code into chat to learn how to post code. See https://www.nohello.net and https://dontasktoask.com if you want common help chat room etiquette.
Buddy
Buddy14mo ago
Please share code as well as the GUI framework you are using
𝚂𝚝𝚊𝚙𝚕𝚎𝚜
I'm using .NET framework, the code aside from the keypresses and unrelated buttons is yet to be added but I'm looking to achieve this specific task for this form to be functional. the combo box for the number is called cboxCandidateNum and the rest is cboxCandidate1, cboxCandidate2, etc.
Will
Will14mo ago
the simplest solution is to subscribe to the SelectedIndexChanged event on your number of candidates combobox, then depending on the selection index, if it's too low then set cboxCandidate2/3/4/5's text to N/A and set their Enabled property to false. if it's within range then set to true and reset the text. that's the jist of it, if you want to write a clean solution to this, think about how a helper function could help here! :)
Buddy
Buddy14mo ago
I'm using .NET framework,
This is not a GUI Framework It is the runtime which is unrelated to the GUI Framework GUI Frameworks such as: - Windows Forms - WPF - WinUI3 .. etc.
nohopestage
nohopestage14mo ago
I know this is not what you're asking for, but I feel like it would be easier to just let the user add candidates as needed
𝚂𝚝𝚊𝚙𝚕𝚎𝚜
Ah, I reconsidered and I'm just gonna do that instead
KidAlchemy
KidAlchemy14mo ago
did you get it working?
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server