I need a little help here with auto fill combo box which will display all the vehicles which are owned by Company.
Please check the screen shot and code and guide me to how to limit the display items in number of 5 so that combo box does not take the full size of page.
I don't want to change anything in query, i want to set it from the code or any available property which can limit it (Note : MaximumDropDownItems is already at 8 still it takes full page). The drop down menu must drop on bottom of the combo box not on upper side of it.
The code for auto fill is as follow :
Dim v As New VehicleMast
dt = v.getvhcl("select Vehicle_NO from MastVehicle")
If com_vhcl_no.InvokeRequired Then
com_vhcl_no.BeginInvoke(New loadVehicleDel(AddressOf loadVehicleSub), cmd, dt)
For Each q In dt.Rows
'.DataSource = dt
.DisplayMember = "Vehicle_NO"
.ValueMember = "Vehicle_NO"
.AutoCompleteMode = AutoCompleteMode.Suggest
.AutoCompleteSource = AutoCompleteSource.ListItems
You can probably set the height of the ComboBox which can show only a few records and else all the records would be scroll-able
you can make 5 items visible for all of the items, by doing something like this:
ComboBox1.DropDownList.Height = ComboBox1.Items.Height * 5
ComboBox1.MaxDropDownItems = 5;