473,848 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5670
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
10759
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 allows the user to either select from the list *or* type in whatever other value they desire. In VB and VBA this is referred to as a Limit to List property. Is there an equivalent form object in html?
1
1420
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 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.
3
26340
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 my code to work. Below is some code which highlights my problem. All I want to do is set the lable control's text property to the value of the selected drop down list value - in this example i've shown the three ways i've tried. Please help!
2
2405
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 that contains rows from a table from a databse (so far easy). • I would like to add a column to the DataGrid that will be a drop-down list so the user will be able to select a value from a pre-defined list of values
5
4234
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); System.Data.SqlClient.SqlCommand dbCommand1 = new System.Data.SqlClient.SqlCommand();
2
3043
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 using the view state so I set EnableViewState on the page to false. To enable the drop down list to bind to a datasource I bind it during the OnInit. I do a response.Write during the SelectedIndexChanged event to verify that the event fires. ...
0
1519
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 database has been made in MSDE. My question is simple, on my Projects form I have a 'search' button, which when clicked re-binds a datagrid with a RowFilter based on a number of user-input parameters. Two of these parameters are drop-down
2
1269
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 followed; 16-18 19-21 22+ I want to capture the student option onto a TextBox, for example if a student chose option one (16-18), I want the TextBox at the button of the page to say student age is "16-18".
3
15013
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 this SQLDataSource I can retrieve my drop down list data. SELECT DISTINCT responsibleMinister FROM responsibleMinister WHERE languageID = @languageID
2
1917
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 tables, one called tbldepartment and the other called tblname. Tbl department has 2 fields in it which are ID and department name(i've set ID to autonumber and it is the primary key). Tbl name also has two fields in it which are IDTab and name(ID...
0
11001
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10664
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10722
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10348
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9500
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5919
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4137
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.