Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Comboobx pulldown problem

Comboobx pulldown problem

Scheduled Pinned Locked Moved C#
helpcsharpvisual-studioquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Denver Thomas
    wrote on last edited by
    #1

    Hi friends , I am using visual studio 2003.In my project I have a combobox populated directly from a dataset using 'displaymember' and 'valuemember' properties.But sometimes my combobox is hanging ie , it can be selected with scroll of mouse but pulldown is not working.Any way to correct this issue friends ? with warm regards

    N 1 Reply Last reply
    0
    • D Denver Thomas

      Hi friends , I am using visual studio 2003.In my project I have a combobox populated directly from a dataset using 'displaymember' and 'valuemember' properties.But sometimes my combobox is hanging ie , it can be selected with scroll of mouse but pulldown is not working.Any way to correct this issue friends ? with warm regards

      N Offline
      N Offline
      nelsonpaixao
      wrote on last edited by
      #2

      I think the way you handle your comboboxes coding are everthing but warm, cold or freezing instead :laugh: But (only) because your regards are warm, i´m going to post you this routine. I assume you know display_member is like country_name(varchar) and value_member is like id_country(int), and you made a store_procedure to fill the combobox (select id_country,country_name FROM dbo.Countries):-D Good Warm Luck:cool:

      public static void ComboBox_Fill(ComboBox myComboBox,
      string store_procedure, string display_member,
      string value_member)
      {
      SqlConnection sql_conn = new SqlConnection(connection_string);
      SqlCommand sql_cmd = new SqlCommand();
      sql_cmd.Connection = sql_conn;
      sql_cmd.CommandText = store_procedure;
      sql_cmd.CommandType = CommandType.StoredProcedure;
      sql_conn.Open();
      SqlDataAdapter sql_da = new SqlDataAdapter();
      sql_da.SelectCommand = sql_cmd;
      DataTable dt = new DataTable();
      sql_da.Fill(dt);
      sql_conn.Close();
      myComboBox.DataSource = dt;
      myComboBox.DisplayMember = display_member;
      myComboBox.ValueMember = value_member;
      }

      nelsonpaixao@yahoo.com.br trying to help & get help

      D 1 Reply Last reply
      0
      • N nelsonpaixao

        I think the way you handle your comboboxes coding are everthing but warm, cold or freezing instead :laugh: But (only) because your regards are warm, i´m going to post you this routine. I assume you know display_member is like country_name(varchar) and value_member is like id_country(int), and you made a store_procedure to fill the combobox (select id_country,country_name FROM dbo.Countries):-D Good Warm Luck:cool:

        public static void ComboBox_Fill(ComboBox myComboBox,
        string store_procedure, string display_member,
        string value_member)
        {
        SqlConnection sql_conn = new SqlConnection(connection_string);
        SqlCommand sql_cmd = new SqlCommand();
        sql_cmd.Connection = sql_conn;
        sql_cmd.CommandText = store_procedure;
        sql_cmd.CommandType = CommandType.StoredProcedure;
        sql_conn.Open();
        SqlDataAdapter sql_da = new SqlDataAdapter();
        sql_da.SelectCommand = sql_cmd;
        DataTable dt = new DataTable();
        sql_da.Fill(dt);
        sql_conn.Close();
        myComboBox.DataSource = dt;
        myComboBox.DisplayMember = display_member;
        myComboBox.ValueMember = value_member;
        }

        nelsonpaixao@yahoo.com.br trying to help & get help

        D Offline
        D Offline
        Denver Thomas
        wrote on last edited by
        #3

        Brother , Thanxxxxx a lot for your reply.The same code I used in my project.Yaa but the problem was with frame work.I converted project in to VS 2005.It is working fine there.Also conversion cleared a lots of unhandled exceptions in my project.Once again thanxx for your reply...Take care

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups