Montanaman
New member
- Joined
- Sep 25, 2007
- Messages
- 4
- Programming Experience
- Beginner
I have the following code and am getting errors saying the name "label2" and "label3" are not declared. (see in red below) Can anyone tell me where I am going wrong?
VB.NET:
For Each thisposting As Posting In thispostingcollection
takeit = False
If thisposting.State.Published = True Then
If thisposting.Template.Name = "StoryDetail" Then
Dim firsttext, secondtext, thirdtext As String
Try
firsttext = thisposting.Placeholders("shorttitle").Datasource.RawContent
If firsttext.Trim = "" Then
firsttext = thisposting.Placeholders("title").Datasource.RawContent
End If
Dim thisplace As HtmlPlaceholder = thisposting.Placeholders("field2")
secondtext = thisplace.Html
thisplace = thisposting.Placeholders("teaser")
thirdtext = thisplace.Html
Catch
End Try
If firsttext <> "" Then
statearray = thisposting.CustomProperties("StateTags").Value
If statearray.IndexOf(mystate) > -1 Then
If firsttime = True Then
Dim headerrow As New TableRow
Dim headercell As New TableCell
headercell.Text = title
headercell.CssClass = "quicklinks_title"
headerrow.Cells.Add(headercell)
Me.scrapetable.Rows.Add(headerrow)
firsttime = False
End If
takeit = True
Dim label1 As New Label
label1.Text = "<b>" & firsttext & "</b>"
If secondtext.Trim <> "" Then
Dim label2 As New Label
label2.Text = "<br>" & secondtext
End If
If thirdtext.Trim <> "" Then
Dim label3 As New Label
label3.Text = "<br>" & thirdtext
End If
Dim label4 As New Label
label4.Text = "<br><br>"
label1.CssClass = "quicklinks_text"
If Not [COLOR="Red"]label2 [/COLOR]Is Nothing Then
[COLOR="Red"]label2[/COLOR].CssClass = "quicklinks_text"
End If
If Not [COLOR="Red"]label3 [/COLOR]Is Nothing Then
[COLOR="Red"]label3[/COLOR].CssClass = "quicklinks_text"
End If
label4.CssClass = "quicklinks_text"
Dim myrow As New TableRow
Dim mycell As New TableCell
mycell.Controls.Add(label1)
If Not [COLOR="Red"]label2[/COLOR] Is Nothing Then
mycell.Controls.Add([COLOR="Red"]label2[/COLOR])
End If
If Not [COLOR="Red"]label3[/COLOR] Is Nothing Then
mycell.Controls.Add([COLOR="Red"]label3[/COLOR])
End If
mycell.Controls.Add(label4)
myrow.Cells.Add(mycell)
Me.scrapetable.Rows.Add(myrow)
incrementcount += 1
If incrementcount = mycount Then
Exit For
End If
End If
End If
End If
End If
Next
Last edited by a moderator: