Bold font for MsgBox in Visual Basic
16,681
Solution 1
As aphoria said, VB's MsgBox does not allow bold text. Here is how you work around that:
1) Add a "New Windows Form" 2) Add a RichTextBox 3) Add the # of CommandButtons you want/need 4) Go to the code for the form and do something like the following
Public Sub CustomMessageBox(ByVal msg As String, ByVal isBold As Boolean, ByVal color As System.Drawing.Color, ByVal buttonOneText As String, ByVal buttonTwoText As String, ByVal startBoldAt As Integer = 0, ByVal endBoldAt As Integer = 0)
' Use parameters to pass the values you want to show
' startBoldAt will be the position in the string where you want to have bold lettering begin, and endBoldAt will be the position in the string where you want bold lettering to end.
End Sub
Then you can do:
Dim cmb as CustomMessageBox = New CustomMessageBox('Your parameters)
' Add a sub that will let you show the CustomMessageBox
cmb.Show()
Hope that helps.
Solution 2
The built-in MsgBox
function cannot do this. You will have to build your own if you really need it.
Author by
Simbox97
Updated on June 15, 2022Comments
-
Simbox97 almost 2 years
How to make font bold in a MessageBox in Visual Basic 2008?
I would like to have it like this:
MsgBox(Documentation: .........)
where "Documentation" will be showing in a bold font.