Results 1 to 3 of 3

Thread: DropDownList

  1. #1

    Thread Starter
    Junior Member drizz's Avatar
    Join Date
    Jan 2004
    Location
    Redmond
    Posts
    19

    DropDownList

    Basically I am trying to write a simple conversion tool. Take x amount of feet and convert that into y amount of meters and vice versa. I am using a whole bunch of different measurements so I decided to use two comboboxes as dropdownlists. Basically, if the user inputs 5 they can then easily select meters to feet or feet to meters, etc.

    I have my equation written but can not figure out for the life of me how to assign a value or key to the items in my dropdownlist. I am using visual studio .net. I populated my list originally using the List Property. How do I give those a property? Say I want Meters to equal sngMet in my code. How would I do that?

    I need to Populate the two lists, give each item in the list a unique ID, tie that id to a value and then insert that value into an equation.

    If you couldn't tell by now, I am a noobie. I am just at the point that looking at this any longer will make me mad! I've tried to RTFM but its a POS.

    Thanks,...
    Drew

  2. #2

    Thread Starter
    Junior Member drizz's Avatar
    Join Date
    Jan 2004
    Location
    Redmond
    Posts
    19
    Here's a sample of the code I am using. The problem is that I can't call my "Item.Key" later in the program. The "Item.Value" prints fine. The "Item.Key" string comes up blank:

    <vb code>
    Dim mySortedList as new System.Collections.SortedList
    Dim Item as DictionaryEntry

    mySortedList("sngMet") = "Meters"
    mySortedList("sngIn") = "Inches"
    mySortedList("sngFt") = "Feet"
    mySortedList("sngCm") = "Centimeters"

    For each Item in mySortedList
    Dim newListItem as new ListItem()
    newListItem.Text = Item.Value
    newListItem.Value = Item.Key
    DropDownList1.Items.Add(newListItem)
    Next

    </vb code>
    Drew

  3. #3
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Try the .net Forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width