Resolved Label not showing whole sentence

Someone123

New member
Joined
Apr 9, 2022
Messages
2
Programming Experience
Beginner
I'm making a project through and I'm trying to add review feature in it.
I can add the review easily but I got stuck when I tried showing reviews.
It only shows 2-3 words from each reviews only.
I thought the datatable may have incomplete info but it had complete info after checking with msgbox
Then I used a existing label to check if it work and it did. It showed the whole review but
I always get trouble showing whole review when I try to add them dynamically.

VB.NET:
For i As Integer = 1 To noofreview
            Dim label6 As New Label
            label6.Location = New Point(xside, yside)
            Label6.ForeColor = Color.White
            Label6.Font = New Font("", 15, FontStyle.Regular)
            dynamicPanel7.Controls.Add(Label6)
            Label6.Text = datatable(i - 1)(0)
            yside = yside + 30
            Dim label8 As New Label
            dynamicPanel7.Controls.Add(label8)
            label8.Location = New Point(xside, yside)
            Label8.ForeColor = Color.White
            label8.Font = New Font("", 10, FontStyle.Regular)
            label8.Text = datatable(i - 1)(1)
            yside = yside + 50
        Next


Form4 09-04-2022 13_32_07.png
 
Solution
This is an example of what you should ALWAYS read the documentation. You're not setting the Size property explicitly so what do you expect the size to be? The documentation for the AutoSize property says this:
When instantiated from code, the default value is False.
so the size of the control will obviously not change automatically based on the Text.
This is an example of what you should ALWAYS read the documentation. You're not setting the Size property explicitly so what do you expect the size to be? The documentation for the AutoSize property says this:
When instantiated from code, the default value is False.
so the size of the control will obviously not change automatically based on the Text.
 
Solution
Most people don't bother but it is definitely something that you should do. You won't always get everything you need or understand everything you get but you will still get a lot of useful stuff and you'll also pick up things that you won't realise are useful until later on. If you're using a new type for the first time, read the documentation and see what members it has. If you're using a new method that you're not sure about or one that doesn't seem to work the way you expect, read the documentation. In the VS code window, you can simply click on something and press F1 to go strait to the relevant documentation, but I'd suggest having the home page bookmarked in your browser too. Barely a day goes by that I don't use that link at least once.
 
Back
Top