Using the Visual Studio IDE, create a Form that contains a buttonlabeled \"About
ID: 3619190 • Letter: U
Question
Using the Visual Studio IDE, create a Form that contains a buttonlabeled "About". When a user clicks the button, display aMessageBox thatcontains your personal copyright statement for the program. Save the project as About.cs.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespaceWindowsFormsApplication1{
public partial class About : Form {
public static void Main(){
}
public About(){
}
private void About_Load(object sender, EventArgs e){
MessageBox.Show("@Copyright 2009, ABC Company Private Limited","Copy Right Information", MessageBoxButtons.OK);
}
}
}
Explanation / Answer
Partial Classes won't work, if you try to compile your codeusing CSC. Here is the working code from Compiler, using System; using System.Windows.Forms; namespace Form { public class DisplayAboutInfo :System.Windows.Forms.Form { private ButtonbtnAbout; publicDisplayAboutInfo() { Text = "Displaying About Form"; btnAbout = new Button (); btnAbout.Text = "About"; btnAbout.Name = "btnAbout"; btnAbout.Size = new System.Drawing.Size (72, 25); this.Controls.Add(btnAbout); btnAbout.Click += new System.EventHandler(btnAbout_Click); } static public voidMain() { Application.Run(new DisplayAboutInfo()); } public voidbtnAbout_Click(object sender, System.EventArgs e) { MessageBox.Show("@Copyright 2009, ABC Company PrivateLimited","Copy Right Information",MessageBoxButtons.OK); } } } Use this command to compile this code CSC /DEBUG /target:winexe YourCodeFileName.cs This will create an exe file. You can directly double click it torun. I hope it helped to you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.