'**** DataGridView 直接显示 **** DataGridViewGpFind.Rows.Clear() Dim cTitle As String = "代码,名称,今开,昨收,今收,最高,最低,买一,卖一,成交量,成交额,买一量,买一,买二量,买二,买三量,买三,买四量,买四,买五量,买五,卖一量,卖一,卖二量,卖二,卖三量,卖三,卖四量,卖四,卖五量,卖五,日期,时间" Dim aTitle As Array = cTitle.Split(",") If Me.DataGridViewGpFind.ColumnCount < 1 Then For c = 0 To aTitle.Length - 1 Me.DataGridViewGpFind.Columns.Add("Col" & c + 1.ToString, aTitle(c)) '添加表格标题 Next End If '添加表格数据 For r = 0 To GpcxArray.Length - 2 cRstr = GpcxArray(r) aCells = cRstr.Split(",") If aCells.Length > 1 Then Me.DataGridViewGpFind.Rows.Add() '添加一空行 For c = 0 To aTitle.Length - 1 If Me.DataGridViewGpFind.Columns(c).HeaderText = "日期" Or Me.DataGridViewGpFind.Columns(c).HeaderText = "时间" Then Me.DataGridViewGpFind.Item(c, r).Value = aCells(c) Else Me.DataGridViewGpFind.Item(c, r).Value = Val(aCells(c)) End If Next End If Next Me.DataGridViewGpFind.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells '设定包括Header和所有单元格的列宽自动调整 Me.DataGridViewGpFind.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells '设定包括Header和所有单元格的行高自动调整 '******************************* |
|
来自: *蓝星* > 《 VB 2015》