0

I wanted to make a function that shows MessageBox with buttons which user chose in ComboBox, but i can't convert string to System.Windows.Forms.MessageBoxButtons. I tried this:

MessageBoxButtons buttons = comboBox1.Text;

and this:

MessageBoxButtons buttons = comboBox1.Text as MessageBoxButtons;

but it shows that cannot convert string to System.Windows.Forms.MessageBoxButtons. Parse function also doesn't work because MessageBoxButtons has no such option Can anyone help me?

Clippy
  • 1
  • 2
  • https://learn.microsoft.com/en-us/dotnet/api/system.enum.parse?view=net-6.0 – Sir Rufo Jan 20 '22 at 15:11
  • 1
    If you actually added MessageBoxButtons enum values to the ComboBox (and didn't allow arbitrary text entry), you should be able to use ```comboBox1.SelectedItem``` – adv12 Jan 20 '22 at 15:14

0 Answers0