Hi,

Could anyone give me some suggestions? Now, I want to put the labels beside the list box to show the number of string lines, but i cant' do adjust all between string lines and labels although the size of text are same. You all will know the smallest size of text is '8'.

how should I do it?

Regards,

zawpai

Hi,
To format controls use Format menu in the VB IDE
To Make Same side, Select the Controls then
Go Format Menu -> Make Same Size.
Similarly
To Make Align Use Format -> Align

List Box having integral height property, set it to false may help u.

Hi selvaganapathy,

I think you are misunderstanding my question. The following attachment is the problem when i execute the code.

Could you please open and see the attachment? I think you will see what the problem is.

Regards,
zawpai

Hi zawpai,
Sorry for the misunderstanding. To Align the label, you must know the each position of the items in the listbox. but it cannot get in VB (I think). For this you must use APIs.

Another idea is why dont use again listbox instead of Labels. Set the background for labels to form background

Hi selvaganapathy,

For this you must use APIs.

Which API should I use?

May be your suggestion is a good ideal using the list box again as labels. I will think about it more.

Thanks,

zawpai

Hi,

Why use API's..?
Just Populate List Box with Serial Numbers and List Items.....
Use "Courier New Font" (Uni-distant font) for the List Box..
and check this :

List1.AddItem "1" & Space(3) & "ABC"
List1.AddItem "2" & Space(3) & "DEF"
List1.AddItem "3" & Space(3) & "TTT"
List1.AddItem "4" & Space(3) & "OERI"

Regards
Veena

Hi QVeen72,

Your suggestions is good, but I don't want to put any extra string in my List box because that the text shown in listbox will be related with the whole project. If I change something in list box, I need to change the whole program. So, I just put the label beside it.
That's why I got the problem.

Is there any way to adjust the string size of the list box?

Thanks,
zawpai

Hi,

Yes you can..
Make Font Name and Font Size of both label and List Box same..

Regards
Veena

Hi,
Another idea why don't you use ListView control (Microsoft Common Control), or FlexGrid Control to display your data in Two Columns. Both controls supports multiple columns. You can display number in one column and your data in another column

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.