There is a basic form for lists. Wrote a procedure that calls the table function of the desired list depending on the idTab parameter passed. In the displayed lists, 4 columns are the same, the others differ in name, quantity of data and total count. The first 4 I add statically in the designer, and how can I add the rest dynamically, depending on the selected list?
1 answer
If we consider that:
- Datagridview
- data through dataSource
It should be something like that, but did not check:
DataGridViewColumn column = new DataGridViewTextBoxColumn();// ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΡΠ΅ΠΌ ΠΊΠΎΠ»ΠΎΠ½ΠΊΡ column.DataPropertyName = "Name";//ΠΈΠΌΡ column.Name = "Knight"; //Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ ΠΊΠΎΠ»ΠΎΠ½ΠΊΠΈ column.DataPropertyName = "GoodGuy";//ΠΏΡΠΈΠ²ΡΠ·ΠΊΠ° ΠΊ ΠΏΡΠΎΠΏΠ΅ΡΡΠΈ ΠΎΠ±ΡΠ΅ΠΊΡΠ° ΠΊΠΎΡΠΎΡΡΠΉ Π½ΡΠΆΠ½ΠΎ ΠΎΡΠΎΠ±ΡΠ°ΠΆΠ°ΡΡ dataGridView1.Columns.Add(column); |
<ΠΈΠΌΡ_ΡΠΎΡΠΌΡ>.Designer.cs. There you can see the code that adds the first four columns and, based on it, write your own. - default locale