编辑的代码:之前的代码效果很好,但无法更改 textbox.text 属性或显示它们来自此循环添加的每个控件
任何帮助表示赞赏
一些子
Dim EqLst As String = ""
Try
Dim con As New SqlConnection
Dim myConString As String = getSQLString()
Dim objcommand As SqlCommand = New SqlCommand
With objcommand
.Connection = con
Dim cmdText As String = "SELECT EquipList from SiteAuditor where client='" & GLClient & "' and market='" & GLMarket & "' and project='" & GLProject & "'"
.CommandText = cmdText
End With
con.ConnectionString = myConString
con.Open()
Using readerObj As SqlClient.SqlDataReader = objcommand.ExecuteReader
'This will loop through all returned records
While readerObj.Read
EqLst = readerObj("EquipList").ToString
Exit While
End While
End Using
con.Close()
Dim li As String() = EqLst.Split(",")
Dim data As New List(Of dataitem)
For Each name As String In li
'Form1.DataRepeater1.AddNew()
data.Add(New dataitem(name))
Form1.DataRepeater1.CurrentItem.Controls("txtName").Text = name
Next
Form1.DataRepeater1.DataSource = data
我想这是我需要了解如何在 datarpeater 控件中添加/更改我的 textox 名称的地方,有人对我有任何解决方案吗?
'For Each name As String In li
' Form1.DataRepeater1.CurrentItemIndex(i).text = name
'Next
Catch ex As Exception
Dim thiserror As String = "Error grabDataRepeaterData, " & vbCrLf _
& "Email Notifying CLS-Software Developemnt about this error was sent."
Dim additionalinfo As String = UserLogin & vbCrLf & UserLogin.Replace("CLSGROUP\", "") & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & ex.ToString
MessageBox.Show(thiserror)
ErrorEmails(thiserror, additionalinfo)
End Try
Return Nothing
结束子
Public Class dataitem
Public Sub New(text As String)
Me.text = text
End Sub
Public Property text As String
End Class