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. Database & SysAdmin
  3. Database
  4. Problems in using single dataset in different VB FORMS

Problems in using single dataset in different VB FORMS

Scheduled Pinned Locked Moved Database
tutorialquestion
4 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.
  • Z Offline
    Z Offline
    Zafar Ayub
    wrote on last edited by
    #1

    Hello! I have been using Datasets and DataAdapters by dragging and dropping on my form. Now I have created a public class and created a dataset by code and filled it wit a Dataadapter. Dataset contains one table "DEPARTMENT" with columns "D_ID" and "D_NAME". Dataset is filled and contains data but when in windows form i tried to bind a combobox to that table it creates problems. 1) dim ClassObj as new DSClass 2)CobmoBox1.datasource = ClassObj.Dataset1.Tables("DEPARTMENT") 3)CobmoBox1.DisplayMember = ????????????????????????? 4)CobmoBox1.DisplayMember = ????????????????????????? Lines 3,4 creates problems, Please guide me

    as900197

    S 1 Reply Last reply
    0
    • Z Zafar Ayub

      Hello! I have been using Datasets and DataAdapters by dragging and dropping on my form. Now I have created a public class and created a dataset by code and filled it wit a Dataadapter. Dataset contains one table "DEPARTMENT" with columns "D_ID" and "D_NAME". Dataset is filled and contains data but when in windows form i tried to bind a combobox to that table it creates problems. 1) dim ClassObj as new DSClass 2)CobmoBox1.datasource = ClassObj.Dataset1.Tables("DEPARTMENT") 3)CobmoBox1.DisplayMember = ????????????????????????? 4)CobmoBox1.DisplayMember = ????????????????????????? Lines 3,4 creates problems, Please guide me

      as900197

      S Offline
      S Offline
      Stephen McGuire
      wrote on last edited by
      #2

      One should be DisplayMember (the column that you want displayed in your combo), the other should be ValueMember (the column that represents the data you want to store). For example, if you have a table with columns ID and Description, you could set your DisplayMember to 'ID' and your ValueMember to 'Description'. On your form, you will see the value in the Description displayed in your combo but you will actually store the corresponding ID when updating your DataSet. CobmoBox1.DisplayMember = "ID" CobmoBox1.ValueMember = "Description" Steve

      Z 1 Reply Last reply
      0
      • S Stephen McGuire

        One should be DisplayMember (the column that you want displayed in your combo), the other should be ValueMember (the column that represents the data you want to store). For example, if you have a table with columns ID and Description, you could set your DisplayMember to 'ID' and your ValueMember to 'Description'. On your form, you will see the value in the Description displayed in your combo but you will actually store the corresponding ID when updating your DataSet. CobmoBox1.DisplayMember = "ID" CobmoBox1.ValueMember = "Description" Steve

        Z Offline
        Z Offline
        Zafar Ayub
        wrote on last edited by
        #3

        Thanks Steve! It was so little mistake and i get so depressed.... Thank you

        as900197

        S 1 Reply Last reply
        0
        • Z Zafar Ayub

          Thanks Steve! It was so little mistake and i get so depressed.... Thank you

          as900197

          S Offline
          S Offline
          Stephen McGuire
          wrote on last edited by
          #4

          You are welcome. Upon reading my answer again, I actually got the values the wrong way round! You would normally have the DisplayMember = "Description" and the ValueMember = "ID". Steve

          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