You can't use a ternary for that. Ternary operations are to decide the output from two options.
string a = <some condition> ? x : y
So "x" and "y" both have to conform to the desired target, ie they have to be "string" as you're ultimately doing either this
string a = x
or this
string a = y
Wanting to put code there like a message box means doing this
string a = "Hello" MessageBox.Show
Obviously that's not valid.