return;
C#
private void sair()
{
return;
}
private static void Exit(string Message, int Code)
{
// Exit the sample when an exception is thrown.
Console.WriteLine("\nFAILED: " + Message + " " + Code.ToString());
Environment.ExitCode = Code;
Environment.Exit(Code);
}
protected void button1_Click(object sender, System.EventArgs e) {
// Populates a list box with three numbers.
int i = 3;
for(int j=1; j<=i; j++) {
listBox1.Items.Add(j);
}
/* Determines whether the user wants to exit the application.
* If not, adds another number to the list box. */
while (MessageBox.Show("Exit application?", "", MessageBoxButtons.YesNo) ==
DialogResult.No) {
// Increments the counter ands add the number to the list box.
i++;
listBox1.Items.Add(i);
}
// The user wants to exit the application. Close everything down.
Application.Exit();
}VB.NET
Private sub Sair()
exit sub
end sub
Private Shared Sub [Exit](ByVal Message As String, ByVal Code As Integer)
' Exit the sample when an exception is thrown.
Console.WriteLine((ControlChars.Lf & "FAILED: " & Message & " " & _
Code.ToString()))
Environment.ExitCode = Code
Environment.Exit(Code)
End Sub 'Exit
Sub button1_Click(sender As object, e As System.EventArgs)
' Populates a list box with three numbers.
Dim i As Integer = 3
Dim j As Integer
For j = 1 To i - 1
listBox1.Items.Add(j)
Next
' Checks to see whether the user wants to exit the application.
' If not, adds another number to the list box.
While (MessageBox.Show("Exit application?", "", MessageBoxButtons.YesNo) = _
DialogResult.No)
' Increments the counter and adds the number to the list box.
i = i + 1
listBox1.Items.Add(i)
End While
' The user wants to exit the application. Close everything down.
Application.Exit()
End Subhttp://msdnwiki.micr...ces(VS.80).aspx
http://p2p.wrox.com/...p?TOPIC_ID=4969










