Referenced By      Properties       Methods Send us your Feedback
SGValueItem Object

Name: SGValueItem
Description: SGValueItem contains translation from database to display value and picture.
GUID: {240E3C92-C2A4-11D2-8EFF-008048E27A77}

 Show Example
 Copy Code     Show Me

The following example uses the CellAsPicture property to create pictures for a value items. To try the example, place BeeGrid on a form. Paste the code into the Declarations section and press F5.

Private Sub SGGrid1_OnInit()
   Dim rs As New ADODB.Recordset
   Dim i As Integer
   
   rs.Fields.Append "Id", adInteger
   rs.Fields.Append "Caption", adBSTR, 50
   
   rs.Open
   
   For i = 1 To 10
      rs.AddNew
      rs!Id = i
      rs!Caption = "Item " & Trim(i)
      rs.Update
   Next
   
   SGGrid1.DataMode = sgBound
   Set SGGrid1.DataSource = rs
   
   With SGGrid1.Columns("Id")
      .Width = 2000
      .Control.Type = sgCellDropList
      .HeadingStyle.TextAlignment = sgAlignLeftCenter
      .Style.TextAlignment = sgAlignLeftCenter
      .Control.PopupStyle.TextAlignment = sgAlignLeftCenter
      While Not rs.EOF
         'if you try to add value items with the code
         'below the grid will accept field object not string
         '.ValueItems.Add rs!Id, rs!Caption
         'just convert it to long/string
         .ValueItems.Add CLng(rs!Id), CStr(rs!Caption)
         rs.MoveNext
      Wend
   End With
   
   rs.MoveFirst
End Sub

Back to topic

Referenced By

SGValueItems.Item