Как вызвать window.alert ( "сообщение"); из C #?

Вы можете вернуть универсальный подстановочный знак <?> для возврата Success и Error для одного и того же метода отображения запросов

public ResponseEntity<?> method() {
    boolean b = // some logic
    if (b)
        return new ResponseEntity<Success>(HttpStatus.OK);
    else
        return new ResponseEntity<Error>(HttpStatus.CONFLICT); //appropriate error code
}

@Mark Norman ответ - правильный подход

16
задан Jamiec 27 September 2010 в 12:26
поделиться

1 ответ

Можно попробовать это:

Hope это работает на Вас..

`private void validateUserEntry()
{
    // 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 = "Error Detected in Input";
    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
    DialogResult result;

    // Displays the MessageBox.
    result = MessageBox.Show(message, caption, buttons);
    if (result == System.Windows.Forms.DialogResult.Yes)
    {
     // Closes the parent form.
        this.Close();
    }
    }
}` 
0
ответ дан 30 November 2019 в 15:25
поделиться
Другие вопросы по тегам:

Похожие вопросы: