combo box width - (how do you change it)

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,

Try this:

At the class level,
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, _
ByVal Msg As Integer, ByVal wParam As Short, _
ByVal lParam As Short) As IntPtr

In the form load event,
' &H160 - CB_SETDROPPEDWIDTH
' 400 - Desired drop-down width
SendMessage(ComboBox1.Handle, &H160, 400, 0)

HTH.

Hello all,
Could anybody tell me how to change the drop down width of the drop down
control for VB.NET!!!

There are loads of examples for vb 6 ie
http://vbnet.mvps.org/index.html?code/listapi/listrightalign.htm

But VB.NET doesn't allow the use of the ANY keyword in the declare
statements.

Any help with this would be super.

Thanks in advance.
Phil.
 
Thanks Shiva,

Now you make me feel guilty.
I see that works for a VB.NET Windows Application, but I forgot to say that I am writing an ASP.NET web application.

Sorry for missleading you. Do you by anychance know how to do this in ASP.NET?
My problem with the code you gave me is that the ComboBox1 does not have the .handle property.
 
Sorry but no.

That would set the width of the DropDown box, but what I am tring to do is set the width of the actual drop down list not the field itself.

I admit my question did not specifically mention this. :-)

Phil
 
Hi,

To my knowledge, drop-down width cannot be changed in ASP.NET; I don't think
we have any control over that.

Thanks Shiva,

Now you make me feel guilty.
I see that works for a VB.NET Windows Application, but I forgot to say that
I am writing an ASP.NET web application.

Sorry for missleading you. Do you by anychance know how to do this in
ASP.NET?
My problem with the code you gave me is that the ComboBox1 does not have the
..handle property.
 
Back
Top