Spread控件

jiangxm80 2003-12-04 12:04:59
我想取出spread控件某一行的记录,该怎么写呢?
...全文
76 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
davidlv 2003-12-04
  • 打赏
  • 举报
回复
'读取单元格的值
'参数vSign是取ComboBox
'型列中数据值时所用,如ComboBox中的
'显示内容为"Y-是",但要取"Y",则vSign为"-"
Public Function CellGetValue(ByVal vSpread As vaSpread, ByVal vRow As Integer, _
ByVal vCol As Integer, Optional ByVal vExtended As Boolean = False, _
Optional ByVal vSign As String = "") As Variant

Dim nRow As Integer, nCol As Integer, nPos As Integer

If vRow < -1 Or vCol < -1 Then Exit Function
With vSpread
nRow = .Row
nCol = .Col
.Row = vRow
.Col = vCol
Select Case .CellType
Case eCellType.TYPE_DATE
If .Value = "" Then
CellGetValue = CDate("1990-01-01")
Else
CellGetValue = .Text
End If

Case eCellType.TYPE_EDIT, eCellType.TYPE_STATIC_TEXT
If .Value = "" Then
CellGetValue = ""
Else
CellGetValue = .Value
End If

Case eCellType.TYPE_FLOAT, eCellType.TYPE_INTEGER
If .Value = "" Then
If vExtended = True Then
CellGetValue = Null
Else
CellGetValue = 0
End If
Else
CellGetValue = .Value
End If

Case eCellType.TYPE_COMBOBOX
If vExtended Then
'CellGetValue = IIf(.Value = "", -1, .Value)
nPos = InStr(1, .Text, vSign)
If nPos <= 1 Then nPos = 2
CellGetValue = Mid(.Text, 1, nPos - 1)
Else
CellGetValue = .Text
End If

Case eCellType.TYPE_BUTTON, eCellType.TYPE_CHECKBOX
If .Value = "" Then
CellGetValue = -1
Else
CellGetValue = .Value
End If

Case eCellType.TYPE_TIME
CellGetValue = .Text

Case eCellType.TYPE_PIC, eCellType.TYPE_PICTURE, eCellType.TYPE_OWNER_DRAWN


Case Else
CellGetValue = .Value

End Select
End With
End Function
hlm750908 2003-12-04
  • 打赏
  • 举报
回复
fpSpread1.GetText fpSpread1.ActiveCol, fpSpread1.ActiveRow, fpvalue


示例中有 RetrieveData中

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧