![]() |
![]() |
Tutorial - Unbound Mode |
In this tutorial, you will learn how to use the unbound mode of the BeeGrid control.
Private Sub CreateColumns()
Dim i As Integer, arKeys As Variant
With SGGrid1
.Columns.RemoveAll False
.DataRowCount = 0
.HeadingColCount = 1
With .Columns.Add("Rank")
.DBField = "Rank"
.Width = 850
.SortType = sgSortTypeNumber
.DataType = sgtLong
.Style.TextAlignment = sgAlignRightCenter
End With
With .Columns.Add("Trend")
.DBField = "Trend"
.Caption = ""
.HeadingPicture = sgbipFirst + 6
.HeadingStyle.DisplayType = sgDisplayPicture
End With
With .Columns.Add("Name")
.DBField = "Name"
.Caption = "Name"
.Width = 2850
End With
With .Columns.Add("Country")
.DBField = "Country"
.Caption = "Country"
.Width = 1850
End With
arKeys = Array("Points", "Tournament", "Next Off")
For i = 5 To 7
With .Columns.Add(arKeys(i - 5))
.DBField = .Key: .Caption = .Key
.Width = 900
.DataType = sgtLong
.SortType = sgSortTypeNumber
.Style.TextAlignment = sgAlignRightCenter
End With
Next
End With
End Sub
These properties can also be set using the following code:
With SGGrid1
.AllowAddNew = True
.AllowDelete = True
'keyboard navigation
.EnterKeyBehavior = sgEnterKeyColumns
.TabKeyBehavior = sgTabColumns
End With
SGGrid1.ImportData App.Path & "\Tennis.txt", sgFormatCharSeparatedValue, , vbCr.
SGGrid1.ExportData App.Path & "\Tennis.txt", sgFormatCharSeparatedValue, sgExportOverwrite, , vbCr
WithSGGrid1.Columns("Trend")
.Width = 305
'change columns style
.Style.DisplayType = sgDisplayPicture
.Style.PictureAlignment = sgPicAlignCenterCenter
'set columns control properties
.Control.PopUpStyle.DisplayType = sgDisplayTextAndPicture
.Control.Type = sgCellDropList
.Control.ShowButton = sgHideButton
.Control.Width = 1600
.Control.PopupAlignment = sgPopupLeft
'add value items. Use built-in pictures
.ValueItems.Add 0, "Unchanged", sgbipFirst
.ValueItems.Add 1, "Up", sgbipFirst + 3
.ValueItems.Add 2, "Down", sgbipFirst + 2
.ValueItems.Add 3, "New", sgbipFirst + 5
.ValueItems.Translate = True
End With
SGGrid1.Groups.Add "Country", sgSortAscending, sgSortTypeString, False, True
SGGrid1.Columns("Country").Hidden = True
With SGGrid1
.Groups.Add "Country", sgSortAscending, sgSortTypeString, False, True
.Columns("Country").Hidden = True
.ColumnClickSort = True
End With
With SGGrid1
'set heading style
.HeadingBackColor = RGB(8, 105, 148)
.HeadingForeColor = vbWhite
.HeadingFont.Bold = True
'even-odd stuff
.ColorEven = vbWhite
.ColorOdd = RGB(239, 239, 239)
.EvenOddStyle = sgEvenOddRows
'misc
.FitLastColumn = True
.RowNumbering = True
.GridLines = sgGridLineNone
.Styles("GroupHeader").BackColor = &HDDFFFF
End With
See Also