Introduction
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
Me.ucGrid1.Cols = 5
Me.ucGrid1.Rows = 1
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.
Properties
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
History
- 20th October, 2007: Initial post