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. Please Help- only have half a day

Please Help- only have half a day

Scheduled Pinned Locked Moved C#
helpquestion
5 Posts 3 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.
  • F Offline
    F Offline
    falles01
    wrote on last edited by
    #1

    I have two questions I hope you can help with. How can I display my combobox display default to blank when I have a bound data source. (I need it that way). I have tried combobox.selectedIndex = -1 but doesn't work. Have also added the column of blank manually like this DataRow newemployeesRow = dataSet1.Tables["employees"].NewRow(); newemployeesRow["Fullname"] = ""; newemployeesRow["Fullname"] = -1; dataSet1.Tables["employees"].Rows.Add(newemployeesRow); It shows a column of -1 in my combobox but it is not set to the default though. the user has to select it. If I remove the combobox.selectedIndex = -1 it displays blank which I want, but it's still not the default. Can someone please help.:wtf:

    V A 2 Replies Last reply
    0
    • F falles01

      I have two questions I hope you can help with. How can I display my combobox display default to blank when I have a bound data source. (I need it that way). I have tried combobox.selectedIndex = -1 but doesn't work. Have also added the column of blank manually like this DataRow newemployeesRow = dataSet1.Tables["employees"].NewRow(); newemployeesRow["Fullname"] = ""; newemployeesRow["Fullname"] = -1; dataSet1.Tables["employees"].Rows.Add(newemployeesRow); It shows a column of -1 in my combobox but it is not set to the default though. the user has to select it. If I remove the combobox.selectedIndex = -1 it displays blank which I want, but it's still not the default. Can someone please help.:wtf:

      V Offline
      V Offline
      VanithaVasu
      wrote on last edited by
      #2

      newemployeesRow["Fullname"] = ""; newemployeesRow["Fullname"] = -1; dataSet1.Tables["employees"].Rows.Add(newemployeesRow); after this try by using this code. dataSet1.AcceptChanges();

      VanithaVasu

      F 1 Reply Last reply
      0
      • V VanithaVasu

        newemployeesRow["Fullname"] = ""; newemployeesRow["Fullname"] = -1; dataSet1.Tables["employees"].Rows.Add(newemployeesRow); after this try by using this code. dataSet1.AcceptChanges();

        VanithaVasu

        F Offline
        F Offline
        falles01
        wrote on last edited by
        #3

        This unfortunately does the same thing as before. It displays -1 in the list instead of a blank, and isn't set as the default anyway. :( ahhhh

        1 Reply Last reply
        0
        • F falles01

          I have two questions I hope you can help with. How can I display my combobox display default to blank when I have a bound data source. (I need it that way). I have tried combobox.selectedIndex = -1 but doesn't work. Have also added the column of blank manually like this DataRow newemployeesRow = dataSet1.Tables["employees"].NewRow(); newemployeesRow["Fullname"] = ""; newemployeesRow["Fullname"] = -1; dataSet1.Tables["employees"].Rows.Add(newemployeesRow); It shows a column of -1 in my combobox but it is not set to the default though. the user has to select it. If I remove the combobox.selectedIndex = -1 it displays blank which I want, but it's still not the default. Can someone please help.:wtf:

          A Offline
          A Offline
          avinob
          wrote on last edited by
          #4

          hii at starting u asked that u wanna have blank in the combox fro default. whaen u remove combobox.selectedIndex=-1 from code u get that then what do u mean by it's not default! please clear the point Thanks Avinob Roy

          F 1 Reply Last reply
          0
          • A avinob

            hii at starting u asked that u wanna have blank in the combox fro default. whaen u remove combobox.selectedIndex=-1 from code u get that then what do u mean by it's not default! please clear the point Thanks Avinob Roy

            F Offline
            F Offline
            falles01
            wrote on last edited by
            #5

            I worked it out thanks. :)

            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