How to call one form to another form using windows application


How to call one form to another form using windows application

How to call one form to another form using windows application

Abstract:-


How to call one form to another form using windows application
Step 1:-
Click File-->New-->Project then click new project window will display
and choose vb.net or c# then give name to it.

Step 2:-
Right click the project name and click Add -->Windows form

Step 3:-

In Form 1 just drag and drop one button control.In button click event just create the object for form2.



Vb.net Code




Public Class Form1

Private Sub BtnShowSecondForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnShowSecondForm.Click
Dim f2 As New Form2
f2.Show()
End Sub
End Class


C# Code



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
}

}





Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: