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. Visual Basic
  4. Deriving combobox

Deriving combobox

Scheduled Pinned Locked Moved Visual Basic
questioncsharpcssdatabase
4 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.
  • M Offline
    M Offline
    Marc LEcuyer
    wrote on last edited by
    #1

    Ok.. here's what I'm trying to do I have a windows form (VB.NET) with a datagrid that display the content of a table in a database. (let's say countries for example) I can edit, delete and add records in this grid. In another windows form, I have a combobox. This combobox displays all countries. I want to add an item in this combobox (Add a country) and when I select it, I have to show the first form to allow the user to add, edit, delete countries and then select one. All changes applied in the grid have to be applied in the combobox and the (Add a country) item must not appear in the grid. How can I add an item manually in the combobox when this one is binded to a datasource? I don't know if it's possible, but if it is, if someone could send me some tips, I would appreciate! Thanks Marc

    L 1 Reply Last reply
    0
    • M Marc LEcuyer

      Ok.. here's what I'm trying to do I have a windows form (VB.NET) with a datagrid that display the content of a table in a database. (let's say countries for example) I can edit, delete and add records in this grid. In another windows form, I have a combobox. This combobox displays all countries. I want to add an item in this combobox (Add a country) and when I select it, I have to show the first form to allow the user to add, edit, delete countries and then select one. All changes applied in the grid have to be applied in the combobox and the (Add a country) item must not appear in the grid. How can I add an item manually in the combobox when this one is binded to a datasource? I don't know if it's possible, but if it is, if someone could send me some tips, I would appreciate! Thanks Marc

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      pls explain ur problem. do u want to add it at run time. (why can't u add it by addItem method) Arvi

      M 1 Reply Last reply
      0
      • L Lost User

        pls explain ur problem. do u want to add it at run time. (why can't u add it by addItem method) Arvi

        M Offline
        M Offline
        Marc LEcuyer
        wrote on last edited by
        #3

        It seems impossible to add an item in the combobox (using the AddItem method) when it's bound to a datasource. (And I talk about System.Windows.Form.Combobox here... I know it's possible with the dropdownlist in asp.net) ... I want to override some methods in the combobox to allow me to add the item manually at runtime after the datasource have been affected to the combobox. Marc

        A 1 Reply Last reply
        0
        • M Marc LEcuyer

          It seems impossible to add an item in the combobox (using the AddItem method) when it's bound to a datasource. (And I talk about System.Windows.Form.Combobox here... I know it's possible with the dropdownlist in asp.net) ... I want to override some methods in the combobox to allow me to add the item manually at runtime after the datasource have been affected to the combobox. Marc

          A Offline
          A Offline
          Andy Smith
          wrote on last edited by
          #4

          I think it might be easier to do 1 of two things: 1) add the "Add A Country" to the DataSource before you bind them. For instance, get the DataSet of all countries, add the new blank country to the top of the DataSet ( or whereever ) with the NewRow and Insert methods, and then set it as the ComboBox's DataSource 2) simply add a button to the form that opens the Country-editor form. Maybe you could make the control's label a "link" or something.

          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