vb6.0将excel导入到mshflexgrid后,显示的数据小数不对,这么改
我是vb6.0的初学者,怎么设置mshflexgrid中的数据格式成“0.00”Dimchart1AsNewADODB.Connection,chart2AsNewADO...
我是vb6.0的初学者,怎么设置mshflexgrid中的数据格式成“0.00”
Dim chart1 As New ADODB.Connection, chart2 As New ADODB.Recordset
chart1.CursorLocation = adUseClient
chart1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\test.xls;Extended Properties='Excel 8.0;HDR=Yes'"
chart2.Open "select * From [sheet1$]", chart1, adOpenKeyset, adLockOptimistic
Set Me.MSHFlexGrid1.DataSource = chart2 展开
Dim chart1 As New ADODB.Connection, chart2 As New ADODB.Recordset
chart1.CursorLocation = adUseClient
chart1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\test.xls;Extended Properties='Excel 8.0;HDR=Yes'"
chart2.Open "select * From [sheet1$]", chart1, adOpenKeyset, adLockOptimistic
Set Me.MSHFlexGrid1.DataSource = chart2 展开
展开全部
再加一段:
For i = 0 To MSHFlexGrid1.Rows - 1
MSHFlexGrid1.Row = i
For j = 0 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Text = Format(MSHFlexGrid1.Text, "0.00")
Next j
Next i
For i = 0 To MSHFlexGrid1.Rows - 1
MSHFlexGrid1.Row = i
For j = 0 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Text = Format(MSHFlexGrid1.Text, "0.00")
Next j
Next i
追问
我试过了,要把MSHflexgrid.text改成MShflexgrid.textmatrix(i,j)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询