⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 9107.html

📁 VB技巧问答10000例 VB技巧问答10000例
💻 HTML
字号:
<html>
  <head>
    <title>将阵列放进DBGrid显示</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>将阵列放进DBGrid显示</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:albert89@ms24.hinet.net">Albert</a> on January 12, 1999 at 13:45:41:<p>
Private Sub Comm_Click()<br>   DBG_Var TestVar<br>End Sub<p>Private Sub DBGrid_UnboundReadData(ByVal RowBuf As MSDBGrid.RowBuffer, StartLocation As Variant, ByVal ReadPriorRows As Boolean)<br>   DBG_URD RowBuf, StartLocation, ReadPriorRows, TestVar<br>End Sub<p>Private Sub DBGrid_UnboundGetRelativeBookmark(StartLocation As Variant, ByVal OffSet As Long, NewLocation As Variant, ApproximatePosition As Long)<br>   DBG_UGRB StartLocation, OffSet, NewLocation, ApproximatePosition, TestVar<br>End Sub<p>'DBGrid显示<br>Public Sub DBG_URD(RowBuf As MSDBGrid.RowBuffer, StartLocation As Variant, ReadPriorRows As Boolean, ByVal DBGVar As Variant)<br>    If IsEmpty(DBGVar) Then Exit Sub<br>    Dim rowsFetched%<br>    Dim incr%<br>    Dim curRow%<br>    Dim J%<br>    rowsFetched% = 0<br>    If ReadPriorRows Then<br>        incr% = -1      ' Reading data backward<br>    Else<br>        incr% = 1       ' Reading data forward<br>    End If<p>    If IsNull(StartLocation) Then<br>        If ReadPriorRows Then<br>           curRow% = UBound(DBGVar, 2) - 1  ' Reading data from the last row<br>        Else<br>            curRow% = 0           ' Reading data from the first row<br>        End If<br>    Else<br>        curRow% = Val(StartLocation) + incr%<br>    End If<p>    Dim I%<br>    I% = 0<p>    While I% < RowBuf.RowCount<br>        If curRow% < 0 Or curRow% >= (UBound(DBGVar, 2) + 1) Then<br>            RowBuf.RowCount = rowsFetched%<br>            Exit Sub<br>        End If<br>        For J% = 0 To UBound(DBGVar, 1)<br>           RowBuf.Value(I%, J%) = DBGVar(J%, curRow%)<br>'        RowBuf.Value(I%, 1) = DBGVar(1, curRow%)<br>'        RowBuf.Value(I%, 2) = DBGVar(2, curRow%)<br>        Next J%<br>        RowBuf.Bookmark(I%) = curRow%<p>        curRow% = curRow% + incr%<br>        rowsFetched% = rowsFetched% + 1<br>        I% = I% + 1<br>    Wend<p>    RowBuf.RowCount = rowsFetched%<br>End Sub<p>Public Sub DBG_UGRB(StartLocation As Variant, OffSet As Long, NewLocation As Variant, ApproximatePosition As Long, ByVal DBGVar As Variant)<br>    If IsEmpty(DBGVar) Then Exit Sub<br>    Dim curRow%<br>    If IsNull(StartLocation) Then<br>        If OffSet < 0 Then<br>            curRow% = OffSet + UBound(DBGVar, 2) ' Reading data from the last row<br>        Else<br>            curRow% = OffSet - 1      ' Reading data from the first row<br>        End If<br>    Else<br>        ' Positioning from StartLocation plus the OffSet<br>        curRow% = Val(StartLocation) + OffSet<br>    End If<p>    If curRow% < 0 Or curRow% >= UBound(DBGVar, 2) Then<br>        NewLocation = Null<br>    Else<br>       NewLocation = curRow%<br>       ApproximatePosition = curRow% + 1  ' One based<br>    End If<p>End Sub<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 9107-->
<!--top: 9133--><li><a href="9133.html">Re: 将阵列放进DBGrid显示(能不能讲清楚一点,能不能有完整范例)</a> <b>Tim </b> <i>08:30:46 1/13/99</i>
(<!--responses: 9133-->0)
<ul><!--insert: 9133-->
</ul><!--end: 9133-->
</ul><!--end: 9107-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -