473,396 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Drop Down list in visual basic

Jon
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.
Nov 22 '05 #1
2 5639
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.
"Jon" wrote:
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.

Nov 22 '05 #2
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.
"Jon" wrote:
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.

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: bonehead | last post by:
This is really a html question but I'm posting it here because it's related to a php site I'm developing. I'd like to have a drop-down box (or 'combo box' as it's called in visual basic) that...
1
by: Jon | last post by:
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...
3
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get...
2
by: Eric Dan | last post by:
Hi, Even tough I was able to implement what I want in a weird and non efficient way, I would like to get an opinion what is the right way to achieve my task: Scenario: • Display a DataGrid...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
2
by: Dave A | last post by:
I am stuggling with databinding a drop down list, hooking into the SelectedIndexChanged and attempting to avoid using the viewstate. The drop down list is quite large so I would prefer to avoid...
0
by: thebison | last post by:
Hi all, I hope someone can help with this relatively simple problem. I am building a timesheet application using ASP.NET C# with Visual Studio 2003.As it is only a protoype application, my...
2
by: Faez | last post by:
How can i add an index name (text) of a Drop-Down List to a TextBox at run time, using Visual Basic language, in Visual Studio 2005? for example: drop down list for student's age are as...
3
by: Brad Isaacs | last post by:
ASP.NET 2.0 / SQL Server 2000 db / Visual Basic Code behind On my .aspx page I have added an SQL Datasource that contains the SQL query to retrieve the list for my Drop Down List Box. Using...
2
by: shaznay2 | last post by:
I need some help! I'm trying to set up two drop down menus where the first displays the Department and the second displays the names of the printers found in the department. So far i have two...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.