fpspread 控件中,知道列名,如何获取其列号?
vb6中,我使用fpspread控件,在知道某列的列名,想获取其所在的列号,如何实现?谢谢--------------------编程问答-------------------- 百度一下... --------------------编程问答-------------------- no found...
大侠帮帮忙 --------------------编程问答--------------------
应该是not found...
也算帮过你了 --------------------编程问答-------------------- UPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUP --------------------编程问答-------------------- 顶上去,困绕啊。。。。。。。。。 --------------------编程问答-------------------- datagrid控件用这个就能实现:DataGrid1.Columns.Item("名字").Caption
fpspread 反倒实现不了?大侠们,该出手了!谢谢!! --------------------编程问答--------------------
Option Explicit--------------------编程问答-------------------- 谢谢 Tiger_Zhao 的回复。
Function ColLetterToNumber(ByVal Letter As String) As Long
Dim lNumber As Long
Dim i As Long
Letter = UCase$(Letter)
For i = 1 To Len(Letter)
lNumber = lNumber * 26 + (Asc(Mid$(Letter, i, 1)) - vbKeyA + 1)
Next
ColLetterToNumber = lNumber
End Function
'测试'
Private Sub Command1_Click()
Dim i As Long
Dim s As String
Dim n As Long
For i = 1 To 100
s = vaSpread1.ColNumberToLetter(i)
n = ColLetterToNumber(s)
Debug.Print i, s, n
Next
End Sub
不知道fpspead控件还有啥更快捷的方法,像datagrid控件用DataGrid1.Columns.Item("名字").Caption就能实现,一句话搞定,那就完美了!
补充:VB , 控件