![]() |
|
[C#] Combobox variable - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Combobox variable (/showthread.php?tid=5490543) |
Combobox variable - DucaRii - Dec 11, 2016 So, my problem is that I want to get the selected item on the combobox as string and use it in another method. Is that possible ? And how? * - Zilog80 - Dec 11, 2016 (Dec 11, 2016 04:10 AM)DucaRii Wrote: So, my problem is that I want to get the selected item on the combobox as string and use it in another method. Is that possible ? And how? Maybe using Text property? PHP Code Side note: switch can be also used * - Vinnilia - Dec 11, 2016 That my friend is very simple. PHP Code * - DucaRii - Dec 11, 2016 (Dec 11, 2016 09:07 AM)Vinnilia Wrote: That my friend is very simple. Ayyy thank you bro. Could you also tell me how to send the string "value" to, for example, the main function * - Zilog80 - Dec 11, 2016 (Dec 11, 2016 11:12 AM)DucaRii Wrote: Ayyy thank you bro. Could you also tell me how to send the string "value" to, for example, the main function PHP Code You are welcome * - DucaRii - Dec 11, 2016 (Dec 11, 2016 11:24 AM)Zilog80 Wrote: Code void mainfunction()Would this work ? * - mrkoolaid - Dec 11, 2016 how about instead of an if statement.. Code if (combo.Text == "Windows")you should switch it up :) Code switch(combo.Text.ToLower())it scales better :) * - ๖ۣۜDiViN3 - Dec 11, 2016 The method: PHP Code Calls the method: PHP Code * - Ninja - Dec 12, 2016 (Dec 11, 2016 11:40 AM)DucaRii Wrote: You obviously dont even know the basics of programming so I suggest you learn those first. * - Vinnilia - Dec 13, 2016 (Dec 11, 2016 11:40 AM)DucaRii Wrote: Meh, replace the two function lines with this: PHP Code * - newmecha - Dec 13, 2016 PHP Code PHP Code PHP Code I think the code is pretty self explaintory if not let me know and I can explain it. Lol and I'm high fuh cause I didn't read he want's the string to use in another method. Can still do that by calling the .Name lol added that in . |