Results 1 to 2 of 2

Thread: [RESOLVED] [2005] Combobox selectedItem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2006
    Posts
    426

    Resolved [RESOLVED] [2005] Combobox selectedItem

    I have a combobox with countries
    Britain
    USA
    Iraq
    Kuwait
    Iran
    Afganistan

    I want to assign certian values for each country so i use this select statement but i cant tell why its not working.Any Idea
    It gives me my orignal values.

    VB Code:
    1. Private a As Double=0
    2. Private b As Double=0
    3. Select Case cbCountries.GetItemText(cbCountries.SelectedItem)
    4.    Case "Britain"
    5.     a=24.78
    6.     b=34.9
    7.   Case "USA"
    8.     a=10  
    9.     b=30.8
    10.   Case "Iraq"
    11.     a=28.1
    12.     b=34
    13.  
    14. End Select
    15.  
    16. Messagebox.Show(a & ":" & b)

    ***EDIT****
    Got it. I had messed up with something small.
    Last edited by maps; Jul 13th, 2006 at 07:50 AM.

  2. #2
    Addicted Member sweet_dreams's Avatar
    Join Date
    Apr 2005
    Location
    Poland, Lodz
    Posts
    189

    Re: [RESOLVED] [2005] Combobox selectedItem

    do you get any error message? i tried this code on my machine and it works perfect.

    where do you declare variable a & b? if in SelectedIndexChanged event of the combobox then change private to dim.

    regards,
    sweet_dreams
    using VB 2010 .NET Framework 4.0; MS Office 2010; SQL Server 2008 R2 Express Edition | Remember to mark resolved threads and rate useful posts.

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