-1

I have a login window where I have 2 sections in combobox which user have to select to what section he/she have to move on. So when user select on option from the combo box and enter the userid and password and click login then he will be moved to a specific form.

IMAGE of the login form:- https://drive.google.com/open?id=19fh710m-9kZU9xXYUFWse8z5d5QZyKMB

karan ugale
  • 123
  • 9
  • Please show the relevant code. and read [this post](https://stackoverflow.com/help/minimal-reproducible-example) to improve your question. – nilsK Jun 19 '19 at 07:09
  • @nilsK I've added the login.cs code. In Login.cs window it has a combo box and combo box have 2 items i.e fee management and general register. All I want is if user selected fee management and logged in then he should be directed to new form of fee management and if he selected general register then he should be directed to new form of general register. Thats all. – karan ugale Jun 19 '19 at 07:17
  • You have a form open `Login` and want to open another one, when a button is clicked? [Please look at this question](https://stackoverflow.com/questions/5548746/c-sharp-open-a-new-form-then-close-the-current-form). – nilsK Jun 19 '19 at 07:21
  • @nilsK Yes! assume user select A from the combo box and click login then he should be directed to A form and if user select B from the combo box and click login then he should be directed to B form – karan ugale Jun 19 '19 at 07:23
  • Where do you struggle? The link i posted above explains how to open a form from another one. Do you have problem getting the selected combobox option? Then use `comboBox1.SelectedIndex` or better `comboBox1.SelectedItem` – nilsK Jun 19 '19 at 07:28

2 Answers2

1
protected voud btnLogin_Click (object sender, EventArgs e)
{
   int status = Convert.ToInt32(cbLogin.Value);

   if (status == 1)
     { 
        Form1 frm1 = new Form1(); //Form 1 the name of the form which you want to open.
        frm1.Show();
        this.Hide()
     }

   else if (status == 2)
     {
        From2 frm2 = new Form2(); //Form 2 the name of the form which you want to open.
        frm2.Show();
        this.Hide();
     }
Syafiqur__
  • 531
  • 7
  • 15
0

Check the selected value:

if (e.SelectedItem == ?)

Open a new form

new MyForm().Show();
programmer444
  • 156
  • 1
  • 5