我想画一个有 2 列的表格。第一列将有 2 行,每行分别包含 a 和 b 字母,第二列不包含任何行。这是我的代码。
Public Class trialtable
Inherits System.Web.UI.Page
Protected Sub trialtable(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim trial As DataTable
trial = New DataTable
Dim tbl As New Table()
Dim szName As String = ""
Dim szNumber As String = ""
Dim szsadasd As String = ""
tbl.BorderColor = Drawing.Color.Black
tbl.BorderWidth = 1
tbl.CellPadding = 0
tbl.CellSpacing = 0
For i As Integer = 0 To 1
Dim tr As New TableRow()
Dim tc1 As New TableCell()
Dim tc2 As New TableCell()
Dim tc3 As New TableCell()
tc1.Controls.Add(New LiteralControl(szName))
tc2.Controls.Add(New LiteralControl(szNumber))
tc3.Controls.Add(New LiteralControl(szsadasd))
tc1.BorderColor = Drawing.Color.Black
tc1.BorderWidth = 1
tc2.BorderColor = Drawing.Color.Black
tc2.BorderWidth = 1
tc3.BorderColor = Drawing.Color.Black
tc3.BorderWidth = 1
tr.Cells.Add(tc1)
tr.Cells.Add(tc2)
tr.Cells.Add(tc3)
tbl.Controls.Add(tr)
Next
Me.Controls.Add(tbl)
End Sub
End Class