如何是Text控件数据输入到MSFlexGrid控件中
求助,新手。如何是 text1、text2、3、4、5中的数据通过点击command控件输入到指定的某一行里。我的总是布满了整个MSFlexGrid控件的网格了。
MSFlexGrid2.zip
(2.69 KB)
Option Explicit Dim SSK As Integer, A1(1 To 100), A2(1 To 100), A3(1 To 100), A4(1 To 100), A5(1 To 100) Private Sub Command1_Click() SSK = SSK + 1 A1(SSK) = Text1.Text: A2(SSK) = Text2.Text: A3(SSK) = Text3.Text: A4(SSK) = Text4.Text: A5(SSK) = Text5.Text Dim I As Integer With MSFlexGrid1 .Rows = 1 + SSK .Cols = 5 For I = 1 To SSK .TextMatrix(I, 0) = A1(I) .TextMatrix(I, 1) = A2(I) .TextMatrix(I, 2) = A3(I) .TextMatrix(I, 3) = A4(I) .TextMatrix(I, 4) = A5(I) Next I End With Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = "": Text5.Text = "" End Sub Private Sub Form_Load() Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = "": Text5.Text = "" With MSFlexGrid1 .Rows = 1 .Cols = 5 .TextMatrix(0, 0) = "序号" .TextMatrix(0, 1) = "日期" .TextMatrix(0, 2) = "时间" .TextMatrix(0, 3) = "深度" .TextMatrix(0, 4) = "备注" .ColWidth(0) = 800 .ColWidth(1) = 1500 .ColWidth(2) = 1200 .ColWidth(3) = 1200 .ColWidth(4) = 1800 End With End Sub
[此贴子已经被作者于2017-8-5 07:46编辑过]