SHARE
Facebook X Pinterest WhatsApp

Customizing the default InputBox Window

This short code sample shows how to subclass the standard VB InputBox function so that you can change the default font and fore/background colors used in the dialogs. The program works by capturing the WM_CTLCOLORDLG, WM_CTLCOLORSTATIC, WM_CTLCOLORBTN messages as the dialog is created. A windows font and brush are then created and returned to the […]

Written By
thumbnail
CodeGuru Staff
CodeGuru Staff
Feb 5, 2004
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

This short code sample shows how to subclass the standard VB InputBox function so that you can change the default font and fore/background colors used in the dialogs.

sshot

The program works by capturing the WM_CTLCOLORDLG, WM_CTLCOLORSTATIC, WM_CTLCOLORBTN messages as the dialog is created. A windows font and brush are then created and returned to the standard windows message handler to handle the custom drawing.

The code can be used in your program by simply calling the ‘InputBoxEx’ function inplace of the usual ‘InputBox’ statement (once you’ve subclassed your form of course).

A full sample project is included.

Download Zipped Project File (10k)

Recommended for you...

Using Multiple Programming Languages to Create an ASP.NET Website
Tariq Siddiqui
Jun 11, 2022
Visual Basic Features in Visual Studio 2022
Hannes DuPreez
Jan 25, 2022
Playing with Strings: Proper Case
Hannes DuPreez
May 27, 2020
Making a Small Lotto Game in VB.NET
Hannes DuPreez
Apr 28, 2020
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.