Export Excel file in to MSFlexGrid
Export Excel file in to MSFlexGrid
API Declarations
Dim rs As New ADODB.Recordset
Rate Export Excel file in to MSFlexGrid
(1(1 Vote))
con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\karthik\testfiles\bctest.xls;Extended Properties=Excel 8.0;Persist Security Info=False")
Set rs = con.Execute("select * from [bctest$]")
i = 1
MsFlexgrid1.Rows = 2
MsFlexgrid1.Cols = rs.Fields.Count
Do While Not rs.EOF
For j = 0 To rs.Fields.Count - 1
MsFlexgrid1.TextMatrix(0, j) = IIf(IsNull(rs.Fields(j).Name), "", rs.Fields(j).Name)
MsFlexgrid1.TextMatrix(i, j) = IIf(IsNull(rs.Fields(j).Value), "", rs.Fields(j).Value)
str = str + IIf(IsNull(rs.Fields(j).Value), "", rs.Fields(j).Value)
Next
i = i + 1
If MsFlexgrid1.Rows <= i Then
MsFlexgrid1.Rows = datagrid1.Rows + 1
End If
rs.MoveNext
Loop
Msflexgrid1.Rows = datagrid1.Rows - 1
Text1.Text = str
End Sub
Export Excel file in to MSFlexGrid Comments
No comments yet — be the first to post one!
Post a Comment