Visual C#.Net Tutorial

Define Visual C#.Net

C# Label Control

C# TextBox Control

C# Button Control

C# RadioButton Control

C# CheckBox Control

C# CheckListBox

C# ListBox Control

C# ComboBox Control

C# LinkLabel Control

C# DateTime DataType

C# DateTimePicker

C# NumericUpDown

C# RandomNumber

C# PictureBox

C# ProgressBar

C# Timer Control

C# ToolTip

C# TabControl

C# RichTextBox

C# MessageBox

C# Menu Control

C# Toolbars

C# Dialogs Box

Define Visual C#.Net

Visual C#.Net

Microsoft C#.Net provides extensive support for building windows applications. Windows applications are event driven. All windows applications present a graphical interface to their users and respond to user interaction. This graphical user interface is called a ‘Windows Form’.
A Windows form may contain controls like label control, textbox control, command button etc.

Controls are visual components that compose the graphical user interface. Everything you see in a GUI is a control, including the form itself. Controls can be applied on the form, from Toolbar by using drag and drop, Tools are grouped inside different categories.

Naming Your Controls
We name our control using its Name property. Naming controls follows the guideline for naming variables such as spaces, special characters, and the use of keywords are prohibited. You can name the control depending on its use. For example, a text box use to retrieve the first name of the user can be named firstName just like a normal variable. But when naming controls, it is better to prefix the name of the control, txt for textbox, btn for button, cmb for combo, rbtn for radiobutton, mnu for menuitem, chk for checkbox.

Q1. Input String and Display with Hello.
Visual C# Question

Form Control - Form is the Container for all controls that make up the user interface. Common Form Properties are:

Attributes Description
AcceptButton The button that is automatically activated when you press Enter.
BackColor Sets the form background color.
CancelButton The button that is automatically activated when you hit Esc key.
ControlBox Use to hide icon and disable the Control box button. By default, this property is True.
Enabled If False, disables the form.
Font Specify default font type, style, size
FormBorderStyle Determines the style and appearance of the form's border
None: Borderless window can not be resized.
Sizable: This is default value and will be used for resizable window that used for displaying regular forms.
FixedDialog: A fixed window, used to create dialog boxes.
FixedSingle: A fixed window with a single line border.
FixedToolWindow: A fixed window with a Close button only.
SizableToolWindow: Same as the FixedToolWindow but resizable. In addition, its caption font is smaller than the usual.
Height Specify height of the Form in pixels.
HelpButton Determines whether a Help button should be displayed in the caption box of the form.
MaximizeBox Use to hide the Maximize button on the title bar.
MinimizeBox Use to hide the Minimize button on the title bar.
MaximumSize Specifies the maximum height and width of the window you can maximize.
MinimumSize Specifies the minimum height and width of the window you can minimize.
Name This is the actual name of the form.
StartPosition This property determines the initial position of the form:
CenterParent: The form is centered in the area of its parent form.
CenterScreen: The form is centered on the monitor.
Manual: The location and size of the form will determine its starting position.
WindowsDefaultBounds: The form is positioned at the default location and size determined by Windows.
WindowsDefaultLocation: The form is positioned at the Windows default location and has the dimensions you’ve set at design time.
Text The text, which appears at the title bar of the form.
TopMost This property specifies whether the form will remain on top of all other forms in your application. Default value is False.

Common Form Methods are:

Attributes Description
Activate Activates the form and gives it focus.
Close Closes the form.
Hide Hide the Controls.
Show Displays the control to the user.
ShowDialog Shows the form as a modal dialog box.

Common Form Events are:

Attributes Description
Activated Occurs when the form is activated in code or by the user.
Click Occurs when the form is clicked.
Closed Occurs before the form is closed.
Closing Occurs when the form is closing.
Deactivited Occurs when the form is no longer in focus.
KeyDown, KeyPress, KeyUp Keyboard Events
Load Occurs before a form is displayed for the first time.
MouseDown, MouseEnter, MouseHover, MouseLeave, MouseMove, MouseUp, MouseWheel
Move Occurs when the form is moved.
Resize Occurs when the control is resized.