Question Open new window containing constructore

Jarus

New member
Joined
Nov 3, 2019
Messages
3
Programming Experience
Beginner
Hi, I am new to winform development.

I'm working on this project where based on criteria Admin window or User window needs to be opened.
But the window that needs to be opened has a paramaterized constructor.

How to open this window ?
winform.PNG

Login.PNG
 
Please don't EVER post pictures of code. It's harder to read and impossible to copy. Code is text so post it as text, formatted as code.

As for the question, if the type constructor has a parameter then you need to pass an argument. How exactly you get that value would require complete guesswork for us as we know nothing about it.
 
On a different note, hiding the login form like that is terrible. You should be closing the login form and passing back the login result to the Main method, then opening the appropriate main form from there.
 
here is my complete code .
After login i want Demo.cs form to be opened and also i need constructor to be instantiated.

Hope you will be able to help me after reviewing my code.
 

Attachments

  • winform.zip
    225.6 KB · Views: 26
Last edited by a moderator:
You don't instantiate a constructor. You call/invoke a constructor to instantiate a type, i.e. create an instance of that type. The entire code isn't really of interest. It's your code so it's your constructor so you should know what the parameter represents, so you should know what object you need to pass to it. It's not for us to tell you how your code works.
 
If you are into WinForms, why is this question under the WPF subforum?
 
LOL! Doing a quick scan over the source code directory structure, it looks like our OP decided to implement a WinForms app using the Model-View-Presenter (MVP) pattern. Unfortunately, it looks like he's stalled out because he doesn't know how to write the Presenter so that the Model(s) get passed to the appropriate View(s).
 
Back
Top Bottom