Designing a registration form, and I get this error when adding in MessageBoxButtons and MessageBoxIcon. The error is "argument 2: cannot convert 'system.windows.forms.Messageboxicon' to 'string'. The piece of code where the error is, is this: **
MessageBox.Show("You have successfully registered your account", MessageBoxIcon.Exclamation, MessageBoxButtons.OK);
** As well as here:
MessageBox.Show("Please fill in all of the boxes correctly", MessageBoxIcon.Exclamation, MessageBoxButtons.OK);
When I remove the Messageboxbutton/icon, there is no error. Here is what I have got:
{
MyConnections.insert.CommandText = "INSERT Customer(EmailAddress,Firstname,Surname,Password)VALUES('" + txtEmail.Text + "','" + txtFirst.Text + "','" + txtSur.Text + "','" + txtPassword.Text + "')";
MyConnections.insert.Connection = MyConnections.Customer;
MyConnections.Customer.Open();
MyConnections.insert.ExecuteNonQuery();
MyConnections.Customer.Close();
if (txtFirst.Text.Length > 0 && txtSur.Text.Length > 0 && txtEmail.Text.Length > 0 && txtPassword.Text.Length > 0 && txtConfirmPass.Text.Length > 0)
{
MessageBox.Show("You have successfully registered your account", MessageBoxIcon.Exclamation, MessageBoxButtons.OK);
}
else
{
MessageBox.Show("Please fill in all of the boxes correctly", MessageBoxIcon.Exclamation, MessageBoxButtons.OK);
}
Here you did have the right order and you forgot to add a caption
MessageBox.Show("You have successfully registered your account","Your caption goes here", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.