There are 2 forms. On 1 form datagridview. It has 3 columns. On the 2nd form datagrid with 1 column. How can the highlighted values of 3 columns from table 1 form fill in a table for 2 form?
In general, I have done something different so far: in the first form, I write down the values of the selected rows of 3 columns in the array. In the second form is the same. But how now in the third table to fill two columns with their values from arrays that are in other forms?
|
1 answer
Well, given the lack of details about the architecture of the application and how, by whom and when these forms are created, I will offer you this option:
public static class Class1 { public static /*Тут переменные/массивы в которых будут сохранятся данные из выбранных строк*/ } Accordingly, you can get access to the fields of this class from any form approximately as follows:
Class1.SomeValueName And then add and arrange this class as you need. In relation to your task, after selecting the elements in the first table, you write them into one array in this class, according to the choice of data from the second table, write to the second array. When you open the third form after initializing the components, read both arrays and fill in the table with the obtained data.
|