<img alt="" src="http://www.codeproject.com/KB/Articles/1127411/Img_3.jpg" style="width: 640px; height: 246px;" />
Introduction
I found myself in need of a classical messagebox
with checkbox
but all the classes I've tried writing in the register Windows preference, however I needed to write the result in the personal .ini setting of the program and so I decided to develop a class of my own that returned the value of the DialogResult and checkbox.
Using the Code
Using the class is very simple. Add the class and resource file to your project and you can use one of the examples attached to the project.
Dim check As Boolean = False
Dim reslt As DialogResult = myMsgBox.Show("writing test 1",
"Test", myMsgBox.Buttons.OK, myMsgBox.Icon.Information,
"do not ask me again", check)
There are 32 different combinations of messagebox
(with or without checkbox
es, custom fonts, buttons with custom text and more).
<img src="http://www.codeproject.com/KB/Articles/1127411/Img_1.jpg" style="height: 85px; width: 640px;" />
Constants are present at the start of the sheet to vary text and size of the messagebox
.
Const frmminWidth As Integer = 345
Const frmminHeight As Integer = 160
Const frmmaxWidth As Integer = 800
Const frmmaxHeight As Integer = 600
Const txtminWidth As Integer = 250
Const txtminHeight As Integer = 60
Const txtmaxWidth As Integer = 700
Const txtmaxHeight As Integer = 500
Const txt_OK As String = "Ok"
Const txt_Cancel As String = "Cancel"
Const txt_Abort As String = "Abort"
Const txt_Retry As String = "Riprova"
Const txt_Ignore As String = "Ignora"
Const txt_Yes As String = "Si"
Const txt_No As String = "No"
The icons in the resource files have been downloaded from here.
History
- September 11, 2016 - First posting