Problem using a Varient.

  • Thread starter Thread starter VB Novice Hendri
  • Start date Start date
V

VB Novice Hendri

Guest
Hi there.

Please have a look at the bottom part of the code: ".Text = result.ActiveContent" I'v aded comments there.

That code block will allso be repeating, but leave that for a next post.

Dim recipeSelected As String = TitleListBox.SelectedItem.ToString()
Dim result = recipesLst.Where(Function(x) x.RecipeName = recipeSelected).FirstOrDefault()
'Form1.TextBox1.Text = result.ID.ToString()

With Form1.RecipeNameLabel
.Text = result.RecipeName
.Visible = True
End With
Form1.Label1.Text = Form1.RecipeNameLabel.Size.ToString

With Form1.CommentLabel
'.Font = ContentFont
.Text = result.Comment
.Location = New Point(Form1.RecipeNameLabel.Left, Form1.RecipeNameLabel.Bottom + 10)
.Visible = True
End With
X = Form1.CommentLabel.Left
Y = Form1.CommentLabel.Bottom + 10

With Form1.QuantityLabel
'.Font = ContentFont
.Text = result.Quantity
.Location = New Point(Form1.RecipeNameLabel.Right - Form1.QuantityLabel.Width, Form1.CommentLabel.Bottom - Form1.QuantityLabel.Height)
.Visible = True
End With


Dim ContentCount As Integer = 1
Dim ActiveContent As String = "Con" + ContentCount

Dim ContentLabel As New Label()
With ContentLabel
.Text = result.ActiveContent 'This Variant represents "Con1" or "Con2" etc. But it don't work, this wher I need help.
If ContentLabel.Text.Contains(":") Then
.Font = New System.Drawing.Font("Comic Sans MS", 12, FontStyle.Bold)
Else
.Font = New System.Drawing.Font("Comic Sans MS", 12, FontStyle.Regular)
End If
.Location = New Point(X, Y)
End With
Controls.Add(ContentLabel)

X = ContentLabel.Left
Y = ContentLabel.Bottom + 1
ContentCount = ContentCount + 1

Continue reading...
 

Similar threads

V
Replies
0
Views
130
VB Novice Hendri
V
V
Replies
0
Views
116
VB Novice Hendri
V
Back
Top