To output a string in a message box:
To ouput a string in a message box with optional parameter "Title":
To output the value of a string variable:
for example a string variable with value "8675309" stored in location 0 or as local_0
The pop instruction is necessary because the MessageBox.Show method returns a value (depending on which buttons is clicked on the form). This value must be removed from the stack before the function returns or will produce an invalid program error.
Code:
ldstr "Message"
call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
pop
To ouput a string in a message box with optional parameter "Title":
Code:
ldstr "Message"
ldstr "Title"
call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string, string)
pop
To output the value of a string variable:
for example a string variable with value "8675309" stored in location 0 or as local_0
Code:
ldloc.0
ldstr "Phone Number"
call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string, string)
pop
The pop instruction is necessary because the MessageBox.Show method returns a value (depending on which buttons is clicked on the form). This value must be removed from the stack before the function returns or will produce an invalid program error.