(急) Visual Basic2005 如何自動新增TextBox 那類型東西?

我在Visual Basic 2005中, 已連結DATABASE,

但是不想用內置的DataGridView來看DATA,

想使用TextBox那類型的東西來看,

但是, TextBox那類型的東西不能自動新增,

每次只可以看第一個DATA記綠,

我應如何做才能使TextBox 那類型自動新增,

來看數十個DATA 記綠呢?

2 Answers

Rating
  • 1 decade ago
    Favorite Answer

    Add a Panel Control named Panel1 to hold the textboxes.

    Suppose you have a DataTable dat

    count = dat.Rows.Count

    For i = 0 To count - 1

    Dim txt As TextBox = New TextBox()

    txt.Text = dat(i)(column_variable)

    Panel1.Controls.Add(txt)

    txt.Top = i * 25

    If i = 9 Then Exit For

    Next

    This is a simple example. If you want to display record 11-20, 21-30, etc, you need to control the paging by setting the start number of the For Loop.

  • 1 decade ago

    ??什麽那類型自動新增?

    不是

    Dim x As TextBox = new TextBox

    之類的東西吧

Still have questions? Get your answers by asking now.