當前位置:編程學習大全網 - 網站源碼 - vb導出VSFlexGrid表中數據到excel和txt中

vb導出VSFlexGrid表中數據到excel和txt中

我這裏有壹段是從dataset寫到excel的,妳只要把ds裏的字段改成vsflexgrid的單元格就可以了,妳先研究壹下,有問題可以再找我.

Dim excel As Excel.Application = New Excel.Application

excel.DisplayAlerts = True

excel.Workbooks.Add(True)

'excel.Visible = True

Dim i As Integer

excel.Cells(8, 1) = "brand_key"

excel.Cells(8, 2) = "Season_Key"

excel.Cells(8, 3) = "article_key"

excel.Cells(8, 4) = "color_key"

excel.Cells(8, 5) = "inseam_key"

For i = 0 To ds.Tables(0).Rows.Count - 1

excel.Cells(i + 9, 1) = ds.Tables(0).Rows(i)("brand_key").ToString().Trim()

excel.Cells(i + 9, 2) = ds.Tables(0).Rows(i)("Season_Key").ToString().Trim()

excel.Cells(i + 9, 3) = ds.Tables(0).Rows(i)("article_key").ToString().Trim()

excel.Cells(i + 9, 4) = ds.Tables(0).Rows(i)("color_key").ToString().Trim()

excel.Cells(i + 9, 5) = ds.Tables(0).Rows(i)("inseam_key").ToString().Trim()

excel.Cells(i + 9, 6) = ds.Tables(0).Rows(i)("size_Key").ToString().Trim()

Next

  • 上一篇:如何進入虛擬主機
  • 下一篇:3d進位和差是啥意思
  • copyright 2024編程學習大全網