Edited Code : the code from before works great but cannot change the textbox.text properties or display them fro each of the controlls added by this loop
any help is appreciated
some sub
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
I guess here is where i need be find out how to add / change my textox names within the datarpeater control anyone have any solutions for me ?
'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
end sub
Public Class dataitem
Public Sub New(text As String)
Me.text = text
End Sub
Public Property text As String
End Class
The DataRepeater has to have its DataSource property set for AddNew to work. It's designed to be data bound.
You can set the dataSource to a list of objects. Then whenever you add to the list, the dataRepeater will automatically show the new items.
Example:
Public Class dataitem
Public Sub New(text As String)
Me.text = text
End Sub
Public Property text As String
End Class
Public Class Form1
Public Sub New()
InitializeComponent()
Dim data As New List(Of dataitem)
data.Add(New dataitem("test1"))
data.Add(New dataitem("test2"))
DataRepeater1.DataSource = data
End Sub
End Class