文本框命名要规范,如 txt_lm_1 txt_lm_2 txt_lm_3
For i As Integer = 1 To 10 Dim str As String = e.Form.controls("txt_lm_" & i).Text If str > "" Then Dim ndr As DataRow = DataTables("表A").AddNew ndr("第一列") = str End IfNext