Windows Forms, data, filter
-
Hi Friends, I am learning .net these days on my own. I have created a small application that gets data from access file. There are multiple rows. in each row i have 8 columns. first column (Product Name) gets data from table1-column1. Second column cell (Dia) gets filtered data based on value incolumn 1. Third column cell gete data based on first and second column. Fourth column based on 1, 2nd, 3rd. (4th column is no of pieces/kg) we put raw material value in 5th column. in 6th Column, we get price per piece in 7th column, we put selling price. 8th column tells us how much we are making or loosing /kg. Pretty simple application. However, i know following limitations of my code 1. its not too optmized. For each drop down, data get retrieved from DB. 2. No of rows are hard coded. 3. Form apearance is not too good. Can we do it using datagrid or some other means? Code is at following location Download code Regards Ajay
-
Hi Friends, I am learning .net these days on my own. I have created a small application that gets data from access file. There are multiple rows. in each row i have 8 columns. first column (Product Name) gets data from table1-column1. Second column cell (Dia) gets filtered data based on value incolumn 1. Third column cell gete data based on first and second column. Fourth column based on 1, 2nd, 3rd. (4th column is no of pieces/kg) we put raw material value in 5th column. in 6th Column, we get price per piece in 7th column, we put selling price. 8th column tells us how much we are making or loosing /kg. Pretty simple application. However, i know following limitations of my code 1. its not too optmized. For each drop down, data get retrieved from DB. 2. No of rows are hard coded. 3. Form apearance is not too good. Can we do it using datagrid or some other means? Code is at following location Download code Regards Ajay
Ajay Fresher wrote:
Can we do it using datagrid or some other means?
A
DataGridView
could work; it would save you from creating and positioning your own controls. Alternatively; I'd build aUserControl
to represent a single line, and drop a collection of those in aPanel
with theAutoScroll
property set to true.Ajay Fresher wrote:
its not too optmized. For each drop down, data get retrieved from DB.
The table "MasterList" looks small enough to keep in memory, but the table "QuoteHistory" might grow large. Is the db local, or is it on a remote computer? If it's local, then it might suffice to review the indexes on the QuoteHistory-table. If it's going to be accessed (read) by more people at the same time, consider switching to SQL Express.
Ajay Fresher wrote:
No of rows are hard coded.
Well, a
DataGridView
(or aPanel
withUserControls
) would make it easier to "add" a line to the form. I guess it's pretty hard to make it dynamic if you have to position all your textboxes and combo's in advance. Focus on adding an item (e.g., aDataGridViewRow
) on demand (a button_click) :)I are Troll :)
-
Ajay Fresher wrote:
Can we do it using datagrid or some other means?
A
DataGridView
could work; it would save you from creating and positioning your own controls. Alternatively; I'd build aUserControl
to represent a single line, and drop a collection of those in aPanel
with theAutoScroll
property set to true.Ajay Fresher wrote:
its not too optmized. For each drop down, data get retrieved from DB.
The table "MasterList" looks small enough to keep in memory, but the table "QuoteHistory" might grow large. Is the db local, or is it on a remote computer? If it's local, then it might suffice to review the indexes on the QuoteHistory-table. If it's going to be accessed (read) by more people at the same time, consider switching to SQL Express.
Ajay Fresher wrote:
No of rows are hard coded.
Well, a
DataGridView
(or aPanel
withUserControls
) would make it easier to "add" a line to the form. I guess it's pretty hard to make it dynamic if you have to position all your textboxes and combo's in advance. Focus on adding an item (e.g., aDataGridViewRow
) on demand (a button_click) :)I are Troll :)
Eddy Vluggen wrote:
A DataGridView could work; it would save you from creating and positioning your own controls. Alternatively; I'd build a UserControl to represent a single line, and drop a collection of those in a Panel with the AutoScroll property set to true.
This looks to be a better approach. I will try.
Eddy Vluggen wrote:
The table "MasterList" looks small enough to keep in memory, but the table "QuoteHistory" might grow large. Is the db local, or is it on a remote computer? If it's local, then it might suffice to review the indexes on the QuoteHistory-table. If it's going to be accessed (read) by more people at the same time, consider switching to SQL Express.
It is just a sample DB. original DB has minimum 50-60 K products. These in turn will have different dias and lengths. This DB will grow big. QuoteHistory will anyways grow big.
Eddy Vluggen wrote:
Well, a DataGridView (or a Panel with UserControls) would make it easier to "add" a line to the form. I guess it's pretty hard to make it dynamic if you have to position all your textboxes and combo's in advance. Focus on adding an item (e.g., a DataGridViewRow) on demand (a button_click)
I agree with that. Still, How can i have similar combobox approach with Datagrid? i.e. 1st column will have all distinct product types. When i select this, dia should be only corresponding to type etc etc.
-
Eddy Vluggen wrote:
A DataGridView could work; it would save you from creating and positioning your own controls. Alternatively; I'd build a UserControl to represent a single line, and drop a collection of those in a Panel with the AutoScroll property set to true.
This looks to be a better approach. I will try.
Eddy Vluggen wrote:
The table "MasterList" looks small enough to keep in memory, but the table "QuoteHistory" might grow large. Is the db local, or is it on a remote computer? If it's local, then it might suffice to review the indexes on the QuoteHistory-table. If it's going to be accessed (read) by more people at the same time, consider switching to SQL Express.
It is just a sample DB. original DB has minimum 50-60 K products. These in turn will have different dias and lengths. This DB will grow big. QuoteHistory will anyways grow big.
Eddy Vluggen wrote:
Well, a DataGridView (or a Panel with UserControls) would make it easier to "add" a line to the form. I guess it's pretty hard to make it dynamic if you have to position all your textboxes and combo's in advance. Focus on adding an item (e.g., a DataGridViewRow) on demand (a button_click)
I agree with that. Still, How can i have similar combobox approach with Datagrid? i.e. 1st column will have all distinct product types. When i select this, dia should be only corresponding to type etc etc.
Ajay Fresher wrote:
Still, How can i have similar combobox approach with Datagrid? i.e. 1st column will have all distinct product types. When i select this, dia should be only corresponding to type etc etc.
That's possible, with an unbound
DataGridViewComboBoxColumn
.I are Troll :)