Thanks, I'll try it and let you know... > Date: Mon, 3 Aug 2009 06:52:02 -0700 > Subject: [DotNetDevelopment] Re: Convert String to Label > From: [email protected] > To: [email protected] > > > 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
_________________________________________________________________ Windows Live™: Keep your life in sync. http://windowslive.com/explore?ocid=PID23384::T:WLMTAGL:ON:WL:en-US:NF_BR_sync:082009
