lillpengen

I got a form "Welcome" and i got "button1". When i press the "button1" i want the form "Welcome" to close.

What code should i write

And how to get a little pop-up window with explanations about the button, when hoover the button and when stop hoovering the button the pop-up disappear

And if anyone now a guide/place with some commands that are usual. you could post it here...

//Lillpengen



Re: Visual C# Express Edition Close command and explanation pop-up

nobugz

In your startup form:
private void Form1_Load(object sender, EventArgs e) {
frmWelcome f = new frmWelcome();
f.StartPosition = FormStartPosition.Manual;
f.Location = new Point(this.Left + (this.Width - f.Width) / 2, this.Top + (this.Height - f.Height) / 2);
f.Show(this);
}

In frmWelcome:
private void btnClose_Click(object sender, EventArgs e) {
this.Close();
}

Use the ToolTip control to display a tooltip.





Re: Visual C# Express Edition Close command and explanation pop-up

VS_Programmer

If you want something more than just a tooltip, try this:

//make your 'box' that show the information a panel and on the panel place the information you want to display

panel1.Location = new Point(where you want the box to be (x), where you want the box to be (y));

panel1.Hide();

//show the panel when the mouse hovers on the button

button1_MouseHover(object sender, EventArgs e)

{

panel1.Show();

}

//hide the panel when the mouse leaves

button1_MouseLeave(object sender, EventArgs e)

{

panel1.Hide();

}

Hope this helps





Re: Visual C# Express Edition Close command and explanation pop-up

lillpengen

nobugz wrote:
In your startup form:
private void Form1_Load(object sender, EventArgs e) {
frmWelcome f = new frmWelcome();
f.StartPosition = FormStartPosition.Manual;
f.Location = new Point(this.Left + (this.Width - f.Width) / 2, this.Top + (this.Height - f.Height) / 2);
f.Show(this);
}

In frmWelcome:
private void btnClose_Click(object sender, EventArgs e) {
this.Close();
}

Use the ToolTip control to display a tooltip.

Was this to close a form

I don't realy understand, does it has to be so much code just to have a quit button a button which closes the form.

I got a form called welcome and a button1 which should close Welcome.





Re: Visual C# Express Edition Close command and explanation pop-up

nobugz

One line of code (this.Close()) is pretty hard to beat. When you find out how to do it in less, please let us know.





Re: Visual C# Express Edition Close command and explanation pop-up

Ganesan

Step -1

Create Two Form one is frmWelcome and other one is frmMessage

step -2

Write this code in frmWelcome form load

private void frmWelcome_Load (object sender, EventArgs e)

{

frmMessage objfrmShow = new frmMessage ();

objfrmShow.ShowDialog();

}

Step -3 this code write with frmMessage form button Click Event

private void btnClose_Click (object sender, EventArgs e)

{

this.Close()

}