G
G
Glebster132022-04-04 07:46:44
C++ / C#
Glebster13, 2022-04-04 07:46:44

How to implement filtering in DataGridView?

Hello. I have a program with the following form:
624a722bec597738256723.png
The gray area is dataGridView1 . The program creates/opens/modifies a text file and adds/deletes lines accordingly.
624a7399470a0405307721.png
This is how the data is stored in a text file: You
624a73b652a6f948758272.png

need to implement the following functionality:


4.1. For a user-specified month, determine which route had the most buses.
4.2. For a user-specified month, display revenue data for each route in ascending order.
4.3. For a month specified by the user, display the number of exits per line for each driver.
4.4. For the specified route, build graphs of changes in the number of exits to the line by day during the specified month.
4.5. For a user-specified month, build a pie chart showing the number of buses on each route.
4.6. Build a bar graph of the distribution of income for the year by route.


As far as I understand, I need to use foreachto go through all the lines and for each cell with an index somehow look at the value of the fourth and fifth characters in the line (because there are 2 digits showing the month), then translate this into , compare with the value (month) , which the user entered in the corresponding one and after all this ... what? Output the received rows to a new grid? Turn off the visibility of other rows? That is, to begin with, I need to somehow select the lines with the month of interest to me, then do something with them (find the most popular route / display income data). Then I need to somehow display for each driver the number of exits (ie the number of mentions of the driver in the table) per line per month.[0]Int32TextBox

For charts in windows forms, there seem to be built-in tools, so I'll probably figure it out with 4.5 and 4.6. But I don't understand how I can complete tasks 4.1, 4.2, 4.3 and 4.4

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2022-04-05
@yarosroman

You immediately load the data directly into the table from the file?
I would create an entity class that describes your data, then serealize the data from the file into a list, make a selection through linq, and bind the filtered list through the DataSource grid.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question