473,794 Members | 2,752 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 5666
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
10757
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
26336
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
2399
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
4233
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
3039
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
1516
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
1267
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
15008
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
1911
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
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
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
10212
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
10161
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
10000
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...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4112
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
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.