Drop Down list in visual basic

G

Guest

I am trying to create a "front end program" to an oracle database and am
using visual basic .net to create the program that will accomplish this.
What i need to do and what i can't find is the code to create a drop down
list with 4 values and one (null) set as a default. I am sorry if i just
can't find the correct article here, i really did try to search for it, so if
anyone could help me i would appreciate it.
 
G

Guest

Hi Jon,

It sounds like you want to use the combo box control. This control is found
on your tool bar. Put the control on your form and then under properties for
the property name, give it a proper name such as: cmbItems. Next the text
property for the combo box will have to be cleared it currently is populated
with : ComboBox1, just back space over this and save it.

Double click the Form and not the control and it should take you into the
form load event. It is usual standard practice to put values into the combo
box during form load so put your code within this area. Since you are only
talking about 4 items you could populate your combo box by using only code
such as:

cmbItems.Items.Add("Value 1")
cmbItems.Items.Add("Value 2")
cmbItems.Items.Add("Value 3")

Since the combobox's default is a null you do not have to worry about
setting it. Remember that what ever is set in the text is what goes to the
database.

What ever is in the cmbItem.text can be sent to the Oracle database or you
can attach it directly using the data source and data member with the Oracle
data adapter.

Hopefully this will solve your problem. Please read more about the combo box
in the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top