摘要:
1.给MSHFlexGrid填充数据通用方法'自定义报表填充程序 fgridPublic Function ShowformfData(Resultset As ADODB.Recordset, ary As Variant, fg As MSHFlexGrid) As Variant Dim cl As field Static GridSetup As Boolean Dim MaxL As Long Dim Op As Long Dim rsl As ADODB.Recordset Dim rows, sl, field_value As Variant Di... 阅读全文
摘要:
1.VB的一些项目中常用的通用方法:' 设置校验键盘输入值,数字Public Function kyd(key As Integer) As Integer'20060728Dim mychar mychar = "0123456789-" & Chr(8) & Chr(46) If InStr(mychar, Chr(key)) = 0 Then kyd = 0 ' MsgBox "只能输入数字" Exit Function Else kyd = key End IfEnd Function' 设置校验键 阅读全文
摘要:
1.VB通用数据操作方法。2.通用数据库查询方法。3.通用数据库操作方法。'ERP查询数据库Public Function YZQuery(sqls As String, msgstring As String) As ADODB.Recordset On Error GoTo ExecuteSQL_Error Set cnn = New ADODB.Connection cnn.ConnectionString = ConnectString cnn.Open Set rst = New ADODB.Recordset rst.Open Trim$(sqls),... 阅读全文
摘要:
1.通用导出Excel功能。2.将MSHFlexGrid数据导出到Excel文件通用功能。3.具体代码如下:'将下列代码保存到一模块文件中,调用方法:Export fgrid1,cd1Public Sub Export(flexgridname As MSHFlexGrid, CD1 As CommonDialog)Dim xlApp As Object 'Excel.ApplicationDim xlBook As Object 'Excel.WorkbookDim xlSheet As Object 'Excel.Worksheet Screen.Mouse 阅读全文
摘要:
1.VB高效导入Excel2003和Excel2007文件到MSHFlexGrid控件显示2.以前也有Excel导入通用功能,但速度有些慢一会把两种实现方式都提供出为参考对比。一、原通用导入excel文件到MSHFlexGrid控件如下:Public Function DRExcel(fd As MSHFlexGrid, CD1 As CommonDialog) As Boolean '导入Excel文件函数 20120621孙广乐Dim file_name As StringDim xlApp As New Excel.ApplicationDim xlBook As Excel.W 阅读全文