✅ Winforms: open two forms at the same time
Good day everyone. So I have an issue (duhh, thats why I am here xD).
I am trying to get a screenshot of the users image...I am using two forms to achieve this, one to show the image and another to screenshot.
When I try open the first form
AspectRatioForm
and then the second SelectArea
. It throws the issue below:
This is the code I wrote:
Now I don't know why this is happening because if I call them separately in terms of their own functions using ShowDialog
they both show one by one (once one form closes the other will show).3 Replies
So a thought just came to my mind on the following issue. What if I open the screenshot form inside the image form...
Where exactly is the issue thrown?
It was thrown here:
I have adjusted the code a lot. I know do this:
Call this function
Inside the aspectRatioForm.take_screenshot
:
This no more throws the error of parameters.
My guess was that when the aspectRatio form was opening, it would not keep the main form(this variable
) and so it was raising that error
So when you try pass the variable this
in the original code here:
there were issues
Ok cool my program works now as a whole.
Goal: I was trying to open two forms, one to show the picture, another to take a screenshot of it. This was just to correct the aspect ratio of the image
Issue: The forms were throwing a Parameter
issue.
Thought process: if it is a parameter issue, that means the variables were either becoming invalid/lost.
Solution: follow the flow of code, open the window (1), and open the next window (2) from the first window (1). This will allow you to pass in the parameters needed for both windows.