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. Windows Forms
  4. Moving Data from one form to another

Moving Data from one form to another

Scheduled Pinned Locked Moved Windows Forms
help
3 Posts 3 Posters 3 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.
  • S Offline
    S Offline
    Squalllllll
    wrote on last edited by
    #1

    i want to copy the data that exists on a gridview column to another form 's listbox >>>> can you help me

    J 1 Reply Last reply
    0
    • S Squalllllll

      i want to copy the data that exists on a gridview column to another form 's listbox >>>> can you help me

      J Offline
      J Offline
      JohnPayton
      wrote on last edited by
      #2

      I would suggest using any type of loop (Do While, For Next etc), what ever you like to get the data from the DataGridView column. Just get the number of rows you wish to copy then loop through the rows, either storing the data returned into the ListBox or populating an Array, which can then be used to fill the ListBox. Note in the example below data is returned from the first column. Dim pInt As Integer Dim pIntItems As Integer Dim pStrValue as String (or what ever the value type of the column is) pIntItems = DataGridView.RowCount For pInt = 0 To pIntItems - 1 pStrValue = DataGridView.Rows(pInt).Cells(0).Value "Now either store this value to an array or make a function call to start populating the ListBox with the value." Next Hope this helps

      S 1 Reply Last reply
      0
      • J JohnPayton

        I would suggest using any type of loop (Do While, For Next etc), what ever you like to get the data from the DataGridView column. Just get the number of rows you wish to copy then loop through the rows, either storing the data returned into the ListBox or populating an Array, which can then be used to fill the ListBox. Note in the example below data is returned from the first column. Dim pInt As Integer Dim pIntItems As Integer Dim pStrValue as String (or what ever the value type of the column is) pIntItems = DataGridView.RowCount For pInt = 0 To pIntItems - 1 pStrValue = DataGridView.Rows(pInt).Cells(0).Value "Now either store this value to an array or make a function call to start populating the ListBox with the value." Next Hope this helps

        S Offline
        S Offline
        Suhas S kulkarni
        wrote on last edited by
        #3

        Hello, 1.Get all the data from gridview into some (public static)variables. 2.In the form where u want those values just write the form name of gridview values followed by the value property of list box. EX. Form.Listboxproperty 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