Tema: MsgBOx
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/05/2003, 10:58
Avatar de Henry Zapata
Henry Zapata
 
Fecha de Ingreso: abril-2001
Mensajes: 125
Antigüedad: 23 años, 11 meses
Puntos: 0
Hola:

Aqui un ejemplo de la ayuda de vs.net :

Private Sub ValidateUserEntry2()


' Checks the value of the text.

If ServerName.Text.Length = 0 Then

' Initializes variables to pass to the MessageBox.Show method.

Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo

Dim Result As DialogResult

'Displays a MessageBox using the Question icon and specifying the No button as the default.

Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)


' Gets the result of the MessageBox display.

If Result = DialogResult.Yes Then

' Closes the parent form.

Me.Close()

End If

End If

End Sub
[C#]

private void validateUserEntry2()
{

// Checks the value of the text.

if(serverName.Text.Length == 0)
{

// Initializes the variables to pass to the MessageBox.Show method.

string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;

// Displays the MessageBox.

result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);

if(result == DialogResult.Yes)
{

// Closes the parent form.

this.Close();

}

}

}


saludos!!