Adjust DataGrids Column Width Based on Longest Field in Underlying Source

Category:
Database
Type:
Snippets
Difficulty:
Intermediate
Author:
Masino Sinaga

Version Compatibility: Visual Basic 6

More information:
When you display data from a database to a DataGrid, you will see that DataGrid's columns width cannot adjust to the longest data in the field. This following procedure can fix the problem.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: