how to display Form2 from Form1 though a keyboard key?

I don't know how to do it with a keystroke, but you can display form 2 by:

Form2 myForm = new Form2();
myForm.Show();

I think that's how you do it. ^

how can we display that form in a particular location

As in a particular spot on screen? No idea. I'm a new coder myself. Did my code work?

ys...........

i got the key interface.........

private void Form1_KeyUp(object sender, KeyEventArgs e)
    {
      if (e.KeyCode == Keys.S)
      {
        Form2 frmForm2 = new Form2();
        frmForm2.Show();
      }
    }

You can set the Form's StartPosition property to CenterScreen, CenterParent, WindowsDefaultLocation or WindowsDefaultBounds. Alternatively you can use the Location property of the form to set the X and Y coordinates of the form, in which case the StartPosition property should be set to Manual. Most often in your situation I tend to use the StartPosition.CenterParent option.

hey like we see in professional software .........if we press the key "Esc", one form with "Are you sure you want to quit" normally comes...........and we could see when we press "Esc" and when that window comes the form that is behind all turns somewhat gray color right..........how can we do that.............

all i've did right now is: when i press "Esc" form2 comes with exit option........when the form behind is still like that............how can i turn that to completly somewhat gray color?

Rather than using a custom form for this, you can use a MessageBox. Here is a link to the MSDN documentation on this very useful class that can display a message with a set of buttons and an icon. You can use this to determine whether or not the user really wants to quit the application.

EDIT: But if you really want to use your custom form you can use the ShowDialog method instead of the Show method, then check the DialogResult that is returned based on which button the user presses.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.