快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

九洲国际官网:VB中MSHFlexGrid控件的应用



运用心得

1)MSHFlexGrid控件 与 MSFlexGrid控件 的异同

MSHFlexGrid控件与Adodc控件绑定,MSFlexGrid控件与Data控件绑定。

2)MSHFlexGrid控件的利用

假如记录集已经在法度榜样中孕育发生,则可以不与Adodc控件绑定,直接在MSHFlexGrid控件中显示数据,并且可以根据必要设置控件中行的颜色,如下例:

Public Function DataGrid_Update() As Boolean

On Error GoTo DataGrid_Update_Err

Dim orarsRecordset As Object

Dim adorsRecordset As New ADODB.Recordset

Dim lngDateDiff As Long

Call gGetData(CONST_GENERALTABLE_TIMEOUT_INFO, orarsRecordset)

If Not ADO_DataBaseOpen(dskAttr, 1) Then

DataGrid_Update = False

Exit Function

End If

adorsRecordset.Cursor九洲国际官网Location = adUseClient

Call adorsRecordset.Open(CONST_VEHICLETABLE_RECORDSET_QUERIED, _

mobjDataSource.ConnectionString, , , adCmdText)

frmShowNewData.grdSaiShin.ColWidth(0) = 800

frmShowNewData.grdSaiShin.ColWidth(1) = 2000

frmShowNewData.grdSaiShin.AllowUserResizing = flexResizeColumns

Set frmShowNewD九洲国际官网ata.grdSaiShin.DataSource = adorsRecordset

Dim i As Integer

i = 0

i = i + 1

While Not adorsRecordset.EOF

lngDateDiff = DateDiff("n", adorsRecordset.Fields("測位日時"), Now)

I九洲国际官网f lngDateDiff > orarsRecordset.Fields("G九洲国际官网EN_V_NUM").Value Then

frmShowN九洲国际官网ewData.grdSaiShin.Row = i

Dim j As Integer

For j = 0 To frmShowNewData.grdSaiShin.Cols - 1

frmShowNewData.grdSaiShin.Col = j

frmShowNewData.grdSaiShin.CellBackColor = &H80FFFF

Next

End If

i = i + 1

adorsRecordset.MoveNext

Wend

Call ADO_DataBaseClose

DataGrid_Update = True

Exit Function

DataGrid_Update_Err:

Call ADO_DataBaseClose

DataGrid_Update = False

End Function

您可能还会对下面的文章感兴趣: