Share yes no dialog vb.net

khacvu529

New member
## Có/không hộp thoại trong vb.net

Hộp thoại Có/Không là hộp thoại phương thức nhắc người dùng chọn giữa hai tùy chọn: Có và Không. Nó thường được sử dụng để xác nhận hành động hoặc yêu cầu người dùng cho phép.

Để tạo hộp thoại Có/Không trong VB.NET, bạn có thể sử dụng các bước sau:

1. Tạo một dự án Windows Forms mới trong Visual Studio.
2. Thêm một biểu mẫu mới vào dự án.
3. Trong cửa sổ ** Thuộc tính **, đặt thuộc tính ** văn bản ** của biểu mẫu thành "Có/không hộp thoại".
4. Nhấp đúp vào biểu mẫu để mở Trình thiết kế ** mẫu **.
5. Kéo nút ** ** Điều khiển từ hộp công cụ ** ** vào biểu mẫu.
6. Trong cửa sổ ** Thuộc tính **, đặt thuộc tính ** văn bản ** của nút thành "Có".
7. Kéo nút ** khác ** Điều khiển từ hộp công cụ ** ** vào biểu mẫu.
8. Trong cửa sổ ** Thuộc tính **, đặt thuộc tính ** văn bản ** của nút thành "Không".
9. Nhấp đúp vào nút ** Có ** để mở ** Nhấp vào ** Trình xử lý sự kiện.
10. Trong ** Nhấp vào ** Trình xử lý sự kiện, thêm mã sau:

`` `
Private Sub Yesbutton_click (người gửi dưới dạng đối tượng, e như EventArgs) xử lý Yesbutton.Click
MessageBox.Show ("Bạn đã nhấp vào nút Có.", "Có/không hộp thoại")
Kết thúc phụ
`` `

11. Bấm đúp vào nút ** no ** để mở ** Nhấp vào ** Trình xử lý sự kiện.
12. Trong ** Nhấp vào ** Trình xử lý sự kiện, thêm mã sau:

`` `
Private Sub Nobutton_click (Người gửi dưới dạng Đối tượng, E As As EventArss) xử lý Nobutton.Click
MessageBox.Show ("Bạn đã nhấp vào nút Không.", "Có/Không hộp thoại")
Kết thúc phụ
`` `

13. Xây dựng và điều hành dự án.

Khi bạn chạy dự án, bạn sẽ thấy hộp thoại Có/Không như sau:

! [Có/Không hộp thoại] ( )

## hashtags

* #vb.net
* #Windows Forms
* #những hộp thoại
* Hộp thoại #Modal
* #Có/Không hộp thoại
=======================================
## Yes/No Dialog in VB.NET

A Yes/No dialog box is a modal dialog box that prompts the user to choose between two options: Yes and No. It is typically used to confirm an action or to ask the user for permission.

To create a Yes/No dialog box in VB.NET, you can use the following steps:

1. Create a new Windows Forms project in Visual Studio.
2. Add a new form to the project.
3. In the **Properties** window, set the **Text** property of the form to "Yes/No Dialog".
4. Double-click the form to open the **Form Designer**.
5. Drag a **Button** control from the **Toolbox** to the form.
6. In the **Properties** window, set the **Text** property of the button to "Yes".
7. Drag another **Button** control from the **Toolbox** to the form.
8. In the **Properties** window, set the **Text** property of the button to "No".
9. Double-click the **Yes** button to open the **Click** event handler.
10. In the **Click** event handler, add the following code:

```
Private Sub YesButton_Click(sender As Object, e As EventArgs) Handles YesButton.Click
MessageBox.Show("You clicked the Yes button.", "Yes/No Dialog")
End Sub
```

11. Double-click the **No** button to open the **Click** event handler.
12. In the **Click** event handler, add the following code:

```
Private Sub NoButton_Click(sender As Object, e As EventArgs) Handles NoButton.Click
MessageBox.Show("You clicked the No button.", "Yes/No Dialog")
End Sub
```

13. Build and run the project.

When you run the project, you will see a Yes/No dialog box like the following:

![Yes/No Dialog Box](https://i.imgur.com/h62472k.png)

## Hashtags

* #vb.net
* #Windows Forms
* #Dialog Boxes
* #Modal Dialog Boxes
* #Yes/No Dialog Boxes
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top