I created the following form for logging.
Howver, messages are not shown. Why ?
How to implement scrolling when writing to last line in login form?
Best guess: you haven't added the Label control to the LoginForm's control
collection. So it's not part of the LoginForm and so doesn't get redrawn
when the form is drawn.
As far as scrolling goes, you can do it a couple of ways. Using the
method you're showing here, you will need to shift all the Text properties
once you run out of room for the Label instances. That is, if creating a
new Label instance would result in a Label instance that is past the
bottom of your form, instead of creating a new Label instance go through
all the existing ones, setting the Text property of the older Label
instance to that of the next-newest one.
If you do this, you should keep track of the Label instances you create,
in the order in which they were created. A List<Label> instance would be
fine for this, using the Add() method to add a new Label each time. You
can retrieve the Labels from the LoginForm's Controls collection, and in
fact they are likely to be in a consistent order. But I wouldn't rely on
it, since as far as I can recall, the order is not documented as reliable.
You could, of course, sort them according to position to determine order,
but IMHO it's easier just to keep a list.
A second way would be to not add a new Label control each time, but rather
to simply have a TextBox to which you add text. You can use the Lines
property to get and set the text in the TextBox using a string array.
Once you reach the maximum number of lines you want to support, simply
remove the first line when you add a new one.
Pete