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