Click here to Skip to main content
13,398,090 members (33,076 online)
Click here to Skip to main content
Add your own
alternative version


31 bookmarked
Posted 20 Oct 2007

Data Grid - Free Grid Control

, 20 Oct 2007
Rate this:
Please Sign up or sign in to vote.
The best free grid control, you can choose any format (font name, bold, italic...) for each field and much more
Screenshot - vb_datagrid.jpg


This is the best free grid control for VB 6. With this control, you can format each field (set font name, bold, italic, underline, align), it's very easy to use. Support AddRow and AddColumn. You can also auto add new row if you accessed to last row. Events (click, change...) give you indexes of last and new column/row. There are many properties, so you can easily create designs as per your wish (fore color, fore color selected, grid color, grid color fixed, back color, back color selected, back color fixed...).

There is also a property called RowFixedData where you can choose what will be printed in rowname field (its first column). You can choose between:

  • UserDefined – show text defined by programmer
  • RowNumber – auto generate row numbers and show them
  • SelectedPointer – Show * at selected row

Example Codes

' Setting row / column count:
Me.ucGrid1.Cols = 5
Me.ucGrid1.Rows = 1
' Set row / column names – if first index is 0 then you change column names, 
' if second index is 0 then you change row names:
Me.ucGrid1.Data(0, 1) = "ID"
Me.ucGrid1.Data(0, 2) = "Name"
Me.ucGrid1.Data(0, 3) = "Phone"

How to Use

This is a standard EXE project. If you want to add this to your project, you must copy all modules and user controls to your project directory. After that, you must add these files to your project.

If you want, you can create an ActiveX project and add this file to this project and create OCX.


  • AutoAddNextRow As Boolean – if True then control will automatically add new row when you access the last row
  • BackColor As OLE_COLOR – data back color
  • BackColorFixed As OLE_COLOR – row / column names back color
  • BackColorContainer As OLE_COLOR – user control back color
  • BackColorSelected As OLE_COLOR – selected field back color
  • Cols As Long – number of columns, when changed all data are deleted
  • Rows As Long – number of rows, when changed all data are deleted
  • Data(ByVal s_row As Long, ByVal s_col As Long) As String – data in selected field
  • Editable As Boolean – if True user can edit fields
  • FldAlign(ByVal mRow As Long, ByVal mCol As Long) As eAlign – (Left, Center or Right) field text (data) align
  • FldFontBold(ByVal mRow As Long, ByVal mCol As Long) As Boolean – field font bold
  • FldFontItalic(ByVal mRow As Long, ByVal mCol As Long) As Boolean – field font italic
  • FldFontName(ByVal mRow As Long, ByVal mCol As Long) As String – field font name
  • FldFontUnderline(ByVal mRow As Long, ByVal mCol As Long) As Boolean – field font underline
  • ForeColor As OLE_COLOR – data fore color
  • ForeColorFixed As OLE_COLOR – row / column name fore color
  • ForeColorSelected As OLE_COLOR – selected field fore color
  • GridColor As OLE_COLOR – grid color (where is data)
  • GridColorFixed As OLE_COLOR – grid color (where is row / col names)
  • SelectedCol As Long – return / set selected column
  • SelectedRow As Long – return / set selected row
  • Sizable As Boolean – if True, user can change field width / height


  • 20th October, 2007: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Croatia Croatia
No Biography provided

You may also be interested in...

Comments and Discussions

Questionvery nice grid Pin
abouldahab24-Jan-16 4:56
memberabouldahab24-Jan-16 4:56 
Questionmake this project Pin
reza nazari27-Jan-09 8:54
memberreza nazari27-Jan-09 8:54 
General[Message Removed] Pin
immetoz6-Oct-08 8:42
memberimmetoz6-Oct-08 8:42 
QuestionHow to add "Merges cells" support to it? Pin
TommyChoi25-Dec-07 15:31
memberTommyChoi25-Dec-07 15:31 
GeneralVS6 :) Pin
mascix20-Oct-07 4:57
membermascix20-Oct-07 4:57 
GeneralRe: VS6 :) Pin
Ivan000121-Oct-07 2:58
memberIvan000121-Oct-07 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180216.1 | Last Updated 20 Oct 2007
Article Copyright 2007 by Ivan0001
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid