[C# - VB] Hướng dẫn khởi động lại chương trình ứng dụng winform
Các bạn sử dụng đoạn script sau để thực hiện khởi động lại ứng dụng của mình:
FULL CODE CSHARP:
private void RestartProgram()
{
// Get file path of current process
var filePath = Assembly.GetExecutingAssembly().Location;
//var filePath = Application.ExecutablePath; // for WinForms
// Start program
Process.Start(filePath);
// For Windows Forms app
Application.Exit();
// For all Windows application but typically for Console app.
//Environment.Exit(0);
}
FULL CODE VISUAL BASIC:
Private Sub RestartProgram()
Dim filePath = Assembly.GetExecutingAssembly().Location
Process.Start(filePath)
Application.[Exit]()
End Sub
Chúc các bạn thành công với thủ thuật đơn giản này.
![[C# - VB] Hướng dẫn khởi động lại chương trình ứng dụng winform [C# - VB] Hướng dẫn khởi động lại chương trình ứng dụng winform](https://cdn.hung.pro.vn/images/img/b/R29vZ2xl/AVvXsEghkHjyRmdE6hDKauA1pe_E3vJbWem9C9XOFcyjjDm7SgAzJikZp2_ywCjqwq-MUmkW_AyQTR7Q3PFGDoL0zY7N8Xuue3hgEM0jE2ALEXTJo3TMxG3T6pYQjTaVoAoNdByz-FxuixQGQp_5vLMSEoEvUxDktY0Qz_MVvtzbI8sD2vhdr2dW3-kNUWDvt_Y/w640-h480/khoi-dong-lai-winform-csharp-visualbasic.jpg)

Comments
MỌI NGƯỜI KHÔNG HIỂU Ở MÃ NGUỒN NÀO THÌ CÓ THỂ BÌNH LUẬN ĐỂ MÌNH HƯỚNG DẪN NHÉ <3
ReplyDelete