Not sure exactly what you're trying to do, but perhaps doing it like
this will work for you : (Watch for syntax, typed in here)
---
Public Function PopulateFormLabels() As Boolean
Dim oLabels As New wmESS_Class()
Dim dsLabels As DataSet
Dim vLabelFieldName, vLabel, str As String
Dim vLabelField, vField As Label
dsLabels = oLabels.GetCurrentLabels()
For Each RowMbr As DataRow In dsLabels.Tables("Labels").Rows
vLabelFieldName = CStr(RowMbr("LabelField"))
vLabel = CStr(RowMbr("Label"))
vLabelField = New Label()
vField = New Label()
vLabelField.ID = vLabelFieldName
vField.Text = vLabel
vLabelField.Text = vLabel
'str = vLabelFieldName & ".Text = " & Chr(34) & vLabel & Chr(34)
'Response.Write(str)
'Add the dynamically created Labels to a container, for e.g., a
Panel:
panel1.Controls.Add(vLabelField)
panel1.Controls.Add(vLabel)
Next
End Function
---
Much cleaner and clearer, I think.
On Aug 2, 9:52 pm, dive_2002 <[email protected]> wrote:
> I'm building an app that has the control (label) name and text stored
> in a SQL table. I'd like to read the record and then apply the label
> from the database to the control on the webpage. This will allow
> users to change the label text as they see fit without me having to
> change any code.
>
> My problem: I'm reading the record data into my app, but cannot seem
> to get the label text to populate on my web page. It seems like I'm
> close but missing something simple (and I'm not a very good
> programmer). Any help would be appreciated...see my code below...
>
> Public Function PopulateFormLabels() As Boolean
> Dim oLabels As New wmESS_Class
> Dim dsLabels As DataSet = New DataSet
> Dim vLabelFieldName As String
> Dim vLabelField As Label = New Label
> Dim vLabel As String
> Dim str As String
> Dim vField As Label = New Label
>
> dsLabels = oLabels.GetCurrentLabels()
>
> Dim RowMbr As DataRow
> For Each RowMbr In dsLabels.Tables("Labels").Rows
> vLabel = ""
> vLabelField.ID = ""
> vLabelField.Text = ""
> vLabelFieldName = ""
>
> vLabelFieldName = RowMbr("LabelField")
> vLabelField.ID = vLabelFieldName
> vField.Text = RowMbr("Label")
> vLabelField.Text = RowMbr("Label")
> vLabel = vLabelField.Text
> 'str = vLabelFieldName & ".Text = " & Chr(34) & vLabel &
> Chr(34)
> 'Response.Write(str)
>
> Next
>
> End Function