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. Binding Objects

Binding Objects

Scheduled Pinned Locked Moved Visual Basic
databasewpfwcfhelp
7 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.
  • I Offline
    I Offline
    ibok23
    wrote on last edited by
    #1

    I am having to bind objects from a database onto visual basic. I have already created the database connection, and the DataAdapter, and the dataSet. Now I am suppose to write code to bind them together. I am confused on how to even start. If I knew how to start then I would be able to do it. Do I need to (Filling a DataSet) also? Whoever can help, I would appreciate it? Thank you, ibok23

    R 1 Reply Last reply
    0
    • I ibok23

      I am having to bind objects from a database onto visual basic. I have already created the database connection, and the DataAdapter, and the dataSet. Now I am suppose to write code to bind them together. I am confused on how to even start. If I knew how to start then I would be able to do it. Do I need to (Filling a DataSet) also? Whoever can help, I would appreciate it? Thank you, ibok23

      R Offline
      R Offline
      Randy S
      wrote on last edited by
      #2

      Use the .fill method of the dataAdapter at load time. Just follow this syntax, 'daInventory.Fill(dsInv1)' You may need to include the table name if there is more then one for your dataset. When your objects on the form are linked you will want to use a Binding ManagerBase to navigate. Then you will use the .Position to change the displayed values. This is all easier if you have some sample code. Is any of this familiar or is all this new? Would you like a code sample?

      G I 2 Replies Last reply
      0
      • R Randy S

        Use the .fill method of the dataAdapter at load time. Just follow this syntax, 'daInventory.Fill(dsInv1)' You may need to include the table name if there is more then one for your dataset. When your objects on the form are linked you will want to use a Binding ManagerBase to navigate. Then you will use the .Position to change the displayed values. This is all easier if you have some sample code. Is any of this familiar or is all this new? Would you like a code sample?

        G Offline
        G Offline
        Guerven
        wrote on last edited by
        #3

        Unlike ADO, ADO.NET works in an unbound manner. No real dynamic connection to a database is provided. use * ADAPTERx.FILL(DATASETx.TABLES("tblname")) to load data into the dataset DATASETx. then use * Datagrid1.datasource = DATASETx.tables("tblname") to display the data in a grid. use * textbox1.datasource = DATASETx.tables("tblname") textbox1.datafield = "a_record_field" to bind a textbox1 keep in mind the unlike in vb6 datagrid, the datagrid in VB.net is disconnected, the update method of the ADAPTER only executes a SQL command defined in the updatecommand object generated with you adapter. and it not always working. Use the me.bindingcontext to manipulate binded controls!:-D its best done MANO a MANO! -Marvin Marvin N. Guerrero - Casting More!!

        1 Reply Last reply
        0
        • R Randy S

          Use the .fill method of the dataAdapter at load time. Just follow this syntax, 'daInventory.Fill(dsInv1)' You may need to include the table name if there is more then one for your dataset. When your objects on the form are linked you will want to use a Binding ManagerBase to navigate. Then you will use the .Position to change the displayed values. This is all easier if you have some sample code. Is any of this familiar or is all this new? Would you like a code sample?

          I Offline
          I Offline
          ibok23
          wrote on last edited by
          #4

          I am very new at this. I am confused also. I have a book that is showing me what to do. But i am still confused. Yes, on a code sample. Thank you, ibok23

          R 1 Reply Last reply
          0
          • I ibok23

            I am very new at this. I am confused also. I have a book that is showing me what to do. But i am still confused. Yes, on a code sample. Thank you, ibok23

            R Offline
            R Offline
            Randy S
            wrote on last edited by
            #5

            I have put together a sample which may help. You can download this from my FTP server. You can access by IP address which will change in time so don't wait too long to download. The files are in a folder called "RandysBoundControls Two Tables". It is about 1.7meg. This is a project I did for school. It should be fully functional. The database is in Access and is stored in the Bin folder. If you recreate the dataset, a .vb file will be rewritten and the lines of code I put there for setting a default value will no longer be there. This will cause an error when you add. Default values are needed for Dates(Date Time Picker) and check boxes (more notes are in the project). I suggest you make a copy. You can program bindings but I did the binding at design time. Look at the DataBindings section of properties for the text boxes. There is a text property there for binding textboxes. The file is at FTP://4.10.187.76

            I 1 Reply Last reply
            0
            • R Randy S

              I have put together a sample which may help. You can download this from my FTP server. You can access by IP address which will change in time so don't wait too long to download. The files are in a folder called "RandysBoundControls Two Tables". It is about 1.7meg. This is a project I did for school. It should be fully functional. The database is in Access and is stored in the Bin folder. If you recreate the dataset, a .vb file will be rewritten and the lines of code I put there for setting a default value will no longer be there. This will cause an error when you add. Default values are needed for Dates(Date Time Picker) and check boxes (more notes are in the project). I suggest you make a copy. You can program bindings but I did the binding at design time. Look at the DataBindings section of properties for the text boxes. There is a text property there for binding textboxes. The file is at FTP://4.10.187.76

              I Offline
              I Offline
              ibok23
              wrote on last edited by
              #6

              I am trying to start to write the code for the binding. In my book it says for me to activate the Code Editor for the form named frmMain. (I am not sure where this is. I can not find it.) that is where I am to start the code is in this section. Well I have started the coding underneath the Windows Form Designer generated code. So far I have..

              dim partRecords as Integer
              partRecords = adbdaParts.fill(dsPart1)

              This is giving me an error on the second line saying I need to declare partRecords. partRecords is how many records I have in my database. Thank you, ibok23

              R 1 Reply Last reply
              0
              • I ibok23

                I am trying to start to write the code for the binding. In my book it says for me to activate the Code Editor for the form named frmMain. (I am not sure where this is. I can not find it.) that is where I am to start the code is in this section. Well I have started the coding underneath the Windows Form Designer generated code. So far I have..

                dim partRecords as Integer
                partRecords = adbdaParts.fill(dsPart1)

                This is giving me an error on the second line saying I need to declare partRecords. partRecords is how many records I have in my database. Thank you, ibok23

                R Offline
                R Offline
                Randy S
                wrote on last edited by
                #7

                I simulated what you said you did and I get an error for partRecords that says "Declaration expected" on the mouse over tip for partRecords, which has the curvy blue line under it. Is that what you got? If so you need to put that code in a sub. It would most likely go in the form loading sub. To create this sub you can double click the form while in [Design] view. If I'm underestimating your intellegence I don't mean to. I just don't know how much VB you know.

                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