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. Set Location of ListView below DataGridView Active Row in C# Winform

Set Location of ListView below DataGridView Active Row in C# Winform

Scheduled Pinned Locked Moved C#
csharpdatabasemysqlvisual-studioalgorithms
5 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.
  • A Offline
    A Offline
    ahmed_one
    wrote on last edited by
    #1

    Tools: Visual Studio 2010 Ultimate, Language C#, Database MySql Hi, I am searching this a while, but to date didn't find any suitable solution. I've a form with bound DataGridView with 5 columns, ProductID, ProductName, Qty, Price and Amount. After normal data entry user can click button to save data to Mysql database, no problem there. At present user is manually enter ProductID after which an Sql command is executed to fetch ProductName and sets it to DataGridView ProductName Column. I need a way to show a ListView below ProductID column when it got focus, so that user can select product (ProductID and ProductName) from ListView and set it to DataGridView's Row which user is currently using. Is it possible to show listview below ProductID cell when user click or when got focus? Thanks Ahmed

    M 1 Reply Last reply
    0
    • A ahmed_one

      Tools: Visual Studio 2010 Ultimate, Language C#, Database MySql Hi, I am searching this a while, but to date didn't find any suitable solution. I've a form with bound DataGridView with 5 columns, ProductID, ProductName, Qty, Price and Amount. After normal data entry user can click button to save data to Mysql database, no problem there. At present user is manually enter ProductID after which an Sql command is executed to fetch ProductName and sets it to DataGridView ProductName Column. I need a way to show a ListView below ProductID column when it got focus, so that user can select product (ProductID and ProductName) from ListView and set it to DataGridView's Row which user is currently using. Is it possible to show listview below ProductID cell when user click or when got focus? Thanks Ahmed

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      You use a data or edit template. Consider popping a dialog as your data entry tool, you will have infinitely more control over your UI and it is dramatically simpler to manage a dialog that faffing about with a DGV.

      Never underestimate the power of human stupidity RAH

      A 1 Reply Last reply
      0
      • M Mycroft Holmes

        You use a data or edit template. Consider popping a dialog as your data entry tool, you will have infinitely more control over your UI and it is dramatically simpler to manage a dialog that faffing about with a DGV.

        Never underestimate the power of human stupidity RAH

        A Offline
        A Offline
        ahmed_one
        wrote on last edited by
        #3

        Thanks for the reply. Using Dialog for data entry is good idea...but can you guide me about how can I show that dialog box when user click or enter in DataGridView row? better if it shows below the current row

        M 1 Reply Last reply
        0
        • A ahmed_one

          Thanks for the reply. Using Dialog for data entry is good idea...but can you guide me about how can I show that dialog box when user click or enter in DataGridView row? better if it shows below the current row

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          Create the dialog for data entry Add - pop the dialog with a new instance of the object save the new object to the database add the saved object to the DGV collection Edit Trap the DGV double click event Check for a selected row in the DGV Pass the select rows data to the dialog save the edited object to the database update the selected rows object with the modifications. Not sure if the last bit is required, it has been too many years since I did winforms :-O

          Never underestimate the power of human stupidity RAH

          A 1 Reply Last reply
          0
          • M Mycroft Holmes

            Create the dialog for data entry Add - pop the dialog with a new instance of the object save the new object to the database add the saved object to the DGV collection Edit Trap the DGV double click event Check for a selected row in the DGV Pass the select rows data to the dialog save the edited object to the database update the selected rows object with the modifications. Not sure if the last bit is required, it has been too many years since I did winforms :-O

            Never underestimate the power of human stupidity RAH

            A Offline
            A Offline
            ahmed_one
            wrote on last edited by
            #5

            Aaa...now I see where the misunderstanding starts... Actually the requirement is not to do the Data entry via dialog but to get data from Dialog/list to DataGridView. That is why I need the listview at first place. The main form contain DataGridView, from which user can make data entry for each product. Which is working just fine for saving/editing/deleting data to database. What I need to provide facility to the data entry process, and give the user a list to select product instead of typing ProductID, user can select product from list and it will copy to Datagridview's active Row alongwith its ProductDesc, the list should only show when user enter ProductID in DataGridView.

            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