Mark
Mark

Reputation: 3

Visual Basic Label Spacing

I am Writing a program where I display sentences with specific options to select from. For example, I will have a label saying "The current car I drive is a" and 3 separate labels after saying Ford Dodge Honda etc.. Based on which label the user clicks, the others will be set to invisible and the selected label will move so the sentence displays like a full sentence without any spacing issues. I am using onclick, label.location = new point(0, 0) which works fine. However, in the program I have many different sentences with many options to chose from and it is very time consuming to find the new points of each label and change them. I was wondering if there is any way to set a standard space between all labels so I would not need to set new points at all.

Upvotes: 0

Views: 374

Answers (1)

JStevens
JStevens

Reputation: 2152

You could say:

rightLabel.Location= New Point(leftLabel.Right,leftLabel.Top)

Or you could use one label with the text "The current car %Who% drives is a %Make% ." then use the replace command:

labe.Text.Replace("%Who%","Fred")
label.Text.Replace("%Make%","Honda")

This way you could have one auto-sizing label, yet change its text easily.

Upvotes: 1

Related Questions