I
I
Igora1232019-11-15 15:37:17
C++ / C#
Igora123, 2019-11-15 15:37:17

How to pass an array from one form to another (c#)?

I have a form, I need to write the values ​​​​from the datagridview to an array and pass it to another form

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2019-11-15
@firedragon

1. Static global array
2. Passing an array through a constructor
3. Saving in settings
4. Saving to a file
5. Message queue.

#
#, 2019-11-15
@mindtester

if you want to work with the same data in different forms, it is better that they exist somewhere separately, perhaps as a field in the main form, with the type:
- an array for a simple case, further on the complication of the task
- a data table https:/ /docs.microsoft.com/ru-ru/dotnet/api/system...
- database https://docs.microsoft.com/ru-ru/ef/
and do binding in grids. then all instances of the datagridview will work with the same source, and even display changes made in another grid
https://docs.microsoft.com/en-us/dotnet/framework/...
https://docs.microsoft.com/ en-us/dotnet/api/system...
https://metanit.com/sharp/entityframework/3.1.php

I
Igora123, 2019-11-15
@Igora123

or how to pass datagridview to another form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question