[C#] Hướng dẫn hiển thị Message Box with Button Details
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
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.
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!