>Hi Anton
>
>Sorry for replying late but I haven't got around to testing your suggestion. Will let you know the feedback. Thanks for responding.
>
>>You can use TextWidth method of the form class to calculate width of text string in pixels. I use it to found the longest string in column and set the column width to that value. Don't forget to set form's Font and FontSize properties to the same values as they are set for your listbox.
Hi Bhavbhuti,
Anton has given you the right answer.
Here is how to calculate it directly (without dealing with form)
nWidth = GetTextWidth( 'Testing', 'Arial', 12, '' )
Function GetTextWidth( tc_Text, tc_FontName, tn_FontSize, tc_FontStyle )
Return ( TxtWidth( tc_Text, tc_FontName, tn_FontSize, tc_FontStyle ) * ;
FontMetric( 6, tc_FontName, tn_FontSize, tc_FontStyle ) )
EndFunc
HTH
Herman