populate drop list with value from a string array -
I have an array of strings in which array(11) = State. (eg. AL, MN, GA,...)
I want to populate this value into a drop down list that already have 50+ states reading from a textfile.
For example:
If my array(11) = GA, I want the drop list selected item to be GA - Georgia.
How can I compare 2 char with items from a text file?
Here's my text file:
State Description
AL Alabama
AK Alaska
AR Arkansas
AZ Arizona
...
Here's how I read the text file
Code:
Public Function GetListOfStates() As String()
Try
'remove the hardcoding, if possible
Using vFileReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(My.Request.PhysicalApplicationPath & "App_Code\States.txt")
Dim grecord(0) As String
' ReDim gStructure(0)
grecord(0) = vbTab
vFileReader.TextFieldType = FileIO.FieldType.Delimited
vFileReader.HasFieldsEnclosedInQuotes = False
vFileReader.SetDelimiters(grecord)
Dim i As Integer = 0
vFileReader.ReadLine() 'throw away first line it's the header
Do While Not vFileReader.EndOfData
ReDim Preserve grecord(i)
grecord(i) = vFileReader.ReadLine
grecord(i) = Replace(grecord(i), vbTab, " - ")
i += 1
Loop
vFileReader.Close()
GetListOfStates = grecord
End Using
Catch ex As Exception
Throw
End Try
End Function
Any idea or input is appreciated. Thanks!
[2005] drop down ---Urgent help asp.net 2.0 -
Hi,
i have 3 drop down lists , for 1st drop down list ,in page load not postback , i am binding database data to the drop down list, for the 2 drop down i am adding items using property window, for the 2nd drop down list i make auto postback is true because after selection of item in
populate drop list with value from a string array -
I have an array of strings in which array(11) = State. (eg. AL, MN, GA,...)
I want to populate this value into a drop down list that already have 50+ states reading from a textfile.
For example:
If my array(11) = GA, I want the drop list selected item to be GA - Georgia.
How c
[2008] List Box /Array Question -
I am new to .net and want to find out how to populate a list box from an array.I have seen examples of binding objects like datatables to a list box but how do you perform this with an ordinary array eg:
I hava an array with 2 elements
MyArray(0,0)="NYC"
MyArray(0,1)=&qu
Drop-down/auto populate -
I am creating a form for a dept. that requested a drop-down of people on the "To" list. They want to be able to choose one of these people and have their address automatically populate that field also. Is that possible in Word?
Thanks!
Creating drop down lists -
Hi
I am creating an excel file that would have to populate drop down lists based on select criteria.
eg. If we select the country in as USA, drop down list1, then drop down two should be populated with the list of states in USA
How do i do this ? . Any help would be highly
Populate drop down list using file names -
I need some advice/help.
I need to be able to populate a dropdown list box using the contents of a directory.
What api's are available that i can call on or what would be a better way of doing this. again I am not using a database of anysort, i need to traverse a certain directo
If text line starts with # then... -
I have a RichTextBox and a Drop Down List, if the users types something like:
#hello
then it add the # and everything after the # into the drop down list, and then if they select one that has been added to the drop down list, then it will goto the line that has the string that they s
DataGrid Adding new Row w/ ComboBox -
Need help,
I am using a datagrid to show variuos activities a client has been in. I can get the first record to populate the first row by using the button click event and a datacombobox attached to that event that populates the row thru a SQL string connected to an ADODC control.
dependant drop down -
i have got three drop downs on my page , the first shows the grades , 2nd the subjects and the third the topics.
I got the first 2 drop downs to work but i cant get the third drop down 2 populate . the third drop down is populated on what the user selected in the 2nd drop down.
I
Quickest Way to Populate a Listbox -
Hello All
I am currently writting an app that will populate a large number of addresses into a list box. My code simply runs through an array adding a line to a list box with each address. This is taking some time though and I wonder if there is a quicker way of doing this. My current
Array - Fixed - 3 dimensions- VB6 -
I need to declare, then populate 3-dimensional fixed array, data from table of of 33 records, 3 columns.
Declare:
Public myArray(32,32,32) as string (assuming zero based array)
I need now to populate all three columns for all records.
How do I populate this? Cannot find in VB he
Newbie - populating a list box/drop-down menu -
Hi all
Simple one this...
Can anyone tell me the 'best' method of populating a drop-down box (what's their correct name?).
I understand that I can specify the contents at design time or I can populate at run time...but what's the best way to store the list?
Should I have it
Get seletected item in drop down list -
I have two simple questions for you.
How can i save the selected item from the drop down list into a variable?[solved]
When the program starts, there is a empty item selected in the drop down when there are no blank spots in the drop down list. how can i make it so on form_load i
excel - list appended to list -
The drop-down 1 selection should output a predefined list somewhere and drop-down 2 selection should append this list with the contents of another predefined list. For example:
from drop down 1 I can select a, b or c. Selecting a gives me the list 1, 2, 3 selcting b gives me i, ii,
Drop Down lists and postback -
I'm experiencing a problem with an app, and I'm not sure what I'm missing.
My app has two drop down lists. When a single selection is made in the first drop down list, the second drop down list is populated with specific data, depending on what was selected in the first. This is d
populate a combobox's list -
How can I populate a combobox's list with data from a table. I currently have the combobox getting it's data by linking to a data control, but it seems to be empty when I click on the drop down button.
Drop-down box with no drop down -
Hi,
I would like to place a drop-down box on my form that when clicked, rather than having the usual list drop down, I want to do something else, such as show another control like a date control or a grid... Do you know what I mean? So I think the only thing I really need to know
Combo Box Drop Down List -
I've got a combo box with 100 list items in the List, the Style is set to 2, and the ListIndex is set to 24. When the user displays the drop down list, the selected list item is highlighted at the top of the list.
What I would like to happen is when the user shows the drop down lis
how to populate pick list from text file -
I have a VB program where people can select a document type from a drop down pick list. I want the end user to be able to customize the document types, so I was thinking it would be easiest to populate this pick list with an external text file or an .ini in the same directory as my .e
[EXCEL] Dynamic Drop Down List -
Hey there, beginner here. Got a task that involves a button which launches a menu box which should include a drop down list, but this list is formed from what is entered in certain cells in the spreadsheet...
I have searched everywhere, but wherever I look I only find references to
Populating one list box with the selection from another combo box -
Hello,
My problem is this, I want to populate a list box with a selection from a drop down list box that is populated by a connection to a SQL database. I am not sure how to do it beyond that it is from VB script. I am not very conversant in VB so I will do my best to interperate any
ToolBar Help!! - Populate Drop Down -
I get a button on a toolbar and I've made it the DROP-DOWN STYLE... How do I populate the dropdown in there??
Can any 1 help?
Thanks in advance
drop down a drop down list -
Is it possible to hit a command button and have a drop down list drop down so the user can see all the choices without clicking on it first?
Thanks,
Dan
drop down list link [resolved] -
Currently I select on the drop list and press a button, then i will be link to the selection of the drop list. But I want to navigate without the button, which means when I select on the drop list, it will bring me to the page. Below are the codes that I am using, Can anybody please h
DDL selection not in list -
Hello Everyone
I'm using Visual Studio 2005.......
I have a drop down list in a grid view template field. The drop dropdown list contains a list of vendors that can change over time. If a record was entered using “Company A” yesterday, “Company A” may not be a valid vend
question about drop down list -
If I have a drop down list how could I code it so if I started to enter the first few charters it would drop down to that item within the list?
selecting a value in drop down -
Hi,
I'm new to .net world.I'm using VS 2005 and C#.My problem is i have got a drop down. i populate the drop down using data set. Now I want a value of the drop down to selected when page loads. for example i have got a drop down which contains departments. I need one of the departmen
[2005] How to populate a drop down box from a dataset -
How do you populate the contents of a drop down box with the results of a dataset? I have already selected the data I want and filled the dataset.
ASP Drop Down Menu -
Hi,
I am currently making an edit page for some employees, one of the fields is pulled form the DB and put into a list/drop down menu.
What I am trying to do is populate the list with the fields from the DB but have the one thats currently assigned to them (in a session variabl
drop down list event -
I'm eveloping a web application (survey) that has a drop down list and a command button. Right now, the user has to make a selection from the list and then hit the command button to fire off the next event. I would like to get rid of the command button altogether. Is there a method
Reset a drop down list -
Hi,
i have a combo box and have set its property value to Drop down list. the problem is that when i save the values, i clear the contents of all controls
how does one reset a drop down list to the original state to be the way it was when the form was loaded.(i.e no value is selec
Drop down list with asterisks -
Sorry, not sure if this is a .Net question.
On a couple of banking web sites I have seen drop-down lists where you select a character from your password. When you click the drop-down list it displays the characters A to Z. As soon as you make a selection and the list box 'closes', a
Excel drop down lists -
I know it's possible to turn a cell into a drop down list manually by going through the options, but I was wondering if anyone knew of a way to create the drop down list using code.
Populating a List -
Hi All,
I am trying to populate a list with the data from one of my tables. I have been able to populate a Text field and move though the data with the data control, is there a set procedure that I should be using to populate the list or could someone give me a example or a tutorial
Populate flexgrid from array -
How can i populate a flexgrid with 52 rows and 8 columns with values that is stored in a 2D array? Im able to save the values that is in the flex grid to an array, but cant seem to populate the grid with the values from the array
how do i get a value of a different field in a drop down list -
ok so i have this drop down list box
and i return all data into it but the text field is the names of places
all i want is the intID value from the selected index, and i cant seem to figure out how to do it
when you select something in the drop down list box it chenges the dat
on_click() event -
Hi,
I have been searching through msdn and unfortunately found that the on_click event doesn't apply to drop down lists, so I was wondering if someone had an alternative for my problem.
Basically, I populate a list box by returning a recordset from a DB, and building a string of
How to get values in a dependent Drop down box (HTMLSelect) -
Hi,
I'm using two drop down boxes, one for state and one for city. Based on what State the user selects, I want my city list to be populated from the database. I can populate a single list from the database on page load but I can't get this to work. What I want is that the onChange ev
Is an array list a control array -
Hi,
I have read that an array list stores objects. So, if an application creates Picturebox control objects at run time, can they be stored in an array list at run time?
Is an array list an array of objects or a linked list of objects?
Also, how do I pass the array list to
Retreive Picture "String Name" from Image Control -
ello all
got 2 arrays of Image Controls. one full of pictures ("Source Array"),
the other empty of pictures ("Target Array").
i'm using Drag n' Drop to "move" pictures from "Source Array" to "Target Array".
on drop onto &quo