NEWS

[C#] Hướng dẫn hiển thị Message Box with Button Details

[C#] Hướng dẫn hiển thị Message Box with Button Details
Đăng bởi: Thảo Meo - Lượt xem: 4862 20:33:12, 27/02/2022DATABASE   In bài viết

Xin chào các bạn, bài viết hôm nay mình sẻ tiếp tục hướng dẫn các bạn cách tạo MessageBox trên Winform có hiển thị button details.

[C#] Show Details Button with MessageBox Winform

detail_messagebox

Thường các thông báo này các bạn hay thấy ở màn hình lỗi của Winform.

error_messagebox

Trong winform c# các bạn muốn hiển thị thông báo như hình các bạn làm theo mình ở đoạn code bên dưới:

var dialogTypeName = "System.Windows.Forms.PropertyGridInternal.GridErrorDlg";
var dialogType = typeof(Form).Assembly.GetType(dialogTypeName);

var dialog = (Form)Activator.CreateInstance(dialogType, new PropertyGrid());

dialog.Text = "Thông báo";
dialogType.GetProperty("Details").SetValue(dialog, "Xin chào các bạn đến với website laptrinhvb.net", null);
dialogType.GetProperty("Message").SetValue(dialog, "Chi tiết thông báo bạn xem ở Details", null);

// Hiển thị dialog.
var result = dialog.ShowDialog();

Thanks for watching!

THÔNG TIN TÁC GIẢ

[C#] Hướng dẫn hiển thị Message Box with Button Details
Đăng bởi: Thảo Meo - Lượt xem: 4862 20:33:12, 27/02/2022DATABASE   In bài viết

CÁC BÀI CÙNG CHỦ ĐỀ

Đọc tiếp