Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 On Error » Шпаргалки
Заголовок



fg - VSFlexGrid
rcd - рекордсет (ADODB.Recordset)
cn - соединение с базой данных (ADODB.Connection)



Sub RefreshVSFlexGrid()

     fg.Redraw = flexRDNone
On Error GoTo err1

     sq = "SELECT * FROM r_Prods"
     rcd.Open sq, cn, adOpenStatic

     With fg
         Set .DataSource = rcd

         .Cell(flexcpAlignment, 0, 0, 0, .Cols - 1) = flexAlignCenterCenter
         .RowHeight(0) = 400

         For i = .FixedCols To .Cols - 1
                 .ColHidden(i) = True
         Next i

         .ColHidden(.ColIndex("ProdID")) = False
         .ColHidden(.ColIndex("ProdName")) = False

         .ColPosition(.ColIndex("ProdID")) = 1
         .ColPosition(.ColIndex("ProdName")) = 2

         .TextMatrix(0, .ColIndex("ProdID")) = "Код"
         .TextMatrix(0, .ColIndex("ProdName")) = "Товар"

         .ColWidth(.ColIndex("ProdID")) = 900
         .ColWidth(.ColIndex("ProdName")) = 2000

     End With

     fg.Redraw = flexRDDirect
     Screen.MousePointer = 0

     Exit Sub
err1:
     fg.Redraw = flexRDDirect
     Screen.MousePointer = 0
     MsgBox "Случилась ошибка!" & Chr(13) & err.Description, vbCritical, "Сообщение"

End Sub