0% found this document useful (0 votes)
734 views5 pages

Sdi and Mdi Application

The document discusses different types of application interfaces in Windows applications, including single document interface (SDI), explorer interface, and multiple document interface (MDI). It provides examples of each type and describes how to build a basic MDI application in C# with multiple child forms and menu options to switch between arithmetic and string manipulation forms. The document also covers modal and modeless dialog boxes, comparing their differences and providing an example application with a main form and modal/modeless child forms for user input.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
734 views5 pages

Sdi and Mdi Application

The document discusses different types of application interfaces in Windows applications, including single document interface (SDI), explorer interface, and multiple document interface (MDI). It provides examples of each type and describes how to build a basic MDI application in C# with multiple child forms and menu options to switch between arithmetic and string manipulation forms. The document also covers modal and modeless dialog boxes, comparing their differences and providing an example application with a main form and modal/modeless child forms for user input.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

SDI AND MDI APPLICATION

 There are various types of application interfaces used for windows


applications.
 Windows application falls into one of three categories
1. Single Document Interface (SDI)
2. Explorer Interface
3. Multiple Document Interface (MDI).

SINGLE DOCUMENT INTERFACE (SDI)

 SDI displays a single document and all the data’s are encapsulated
within a single form.
 Example Calculator, Notepad in windows platform.
 These applications will open in the same environment.

EXPLORER INTERFACES

 Hierarchy of information is presented to the user,


 It is displayed using Tree View control on the left and the details of the
selected node are provided with the List View control.
Example: Windows Explorer Application.

MULTIPLE DOCUMENT INTERFACES (MDI)

 Multiple Document Interface (MDI) allows multiple views of one or more


documents that are encapsulated to display at the same type.
 Single window acted as a container for other windows and the contained
window displays other windows.
 Example: Microsoft word / Excel.
 MDI acts as sharing a parent – child relationship.
 MDI can have one or more MDI parent forms and each MDI parent form
can have multiple MDI child forms.

BUILDING MDI APPLICATION

1. Create a new window applications


2. Make the parent form as MDI parent by changing the property
IsMDIContainer as true.
3. Add 2 new forms in the solution Explorer by Right Clicking and Add
Form.
4. Add a Menustrip to the MDI form and add main menu as Computation
and the submenus as
i. Arithmetic Computation – mnuartithcomp (name)
ii. String manipulation – mnustringmanip (name)
iii. Exit – mnuexit
5. Write the coding as
Mnuarithcomp click event
Form2 f1 = new Forms();
f1.MdiParent = this;
f2.show();
f1.Text=”computation for Arithmetic”;
mnustringmanip click event
Form3 f2 = new Form3();
f2.MdiParent=this;
f2.show();
f2.Text = “string manipulation”;
mnuexit click event
Application.Exit();
6. Design the Form2 as follows
Add three labels, First Number, Second Number, Result respectively.
Add three buttons for Addition, subtraction and Multiplication
Add a button naming Back to main menu.
Add three text boxes
7. Write the coding as follows for buttons
i. Add Button – click event
int x = Convert.ToInt32(textBox1.Text);
int y = Convert.ToInt32(textBox2.Text);
int ans = x + y;
textBox3.Text = ans.ToString();
// same as write the code for subtraction and multiplication.
ii. Back to Mainmenu button click event
this.Close();
8. Design the Form3 as follows
Add a label “Enter The String” and a textbox.
Add 5 buttons as Lowercase, Uppercase, Boldformat, Italicformat, Back
to Mainmenu.
9. Write the coding for buttons as follows
i. Lower case – click event.
textBox1.Text = textBox1.Text.ToLower();
ii. Upper case – click event.
textBox1.Text = textBox1.Text.ToUpper();
iii. Bold Format – click event.
textBox1.Font = new Font(textBox1.Font.FontFamily,14,
textBox1.Font.Style ^ FontStyle.Bold);
iv. Italic Format – click event
textBox1.Font = new Font(textBox1.Font.FontFamily,14,
textBox1.Font.Style ^ FontStyle.Italic);
v. Back to Main Menu – click event
this.Close();
MODAL AND MODELESS DIALOG IN C#

Modal Dialog Box

 Modal Dialog Box is the dialog box in which the user response is required
before continuing the program.
 Example: open Dialog Box – when it is displaying the user can not use
any other operations on any windows. (ie) user has to first response for
that Dialog box.

Modeless Dialog Box

 Modeless Dialog Box is the dialog box in which the form or the dialog box
remains stable and available to the user for use at any time. So the user
can access other windows without responding to the Modeless Dialog
Box.

Differences

 showDialog() method is used to display modal dialog box show() method


is used to display modeless dialog box.
 Parent Window cannot be accessed without responding to Modal Dialog
Box.
 Parent Window can be accessed even if the Modeless DialogBox is not
responded.

Example

1. Add a Main Form with the following design

 Add two text boxes and change the name property as txtName
and txtAddress.
 Change the Multiline property as true and Readonly property as
true for txtAddress.
 Add two forms by Rightclicking the project and select Add ->
Windows Form.
 Change the name property for two forms as AboutForm and
AddressDlg.
2. Design the AboutForm as Follows
i. Add a label and change the text property as Modal and Modeless
Dialog box.
3. Design the AddressDlg as follows

i. Changes in button ok
Name – btnok
DialogResult – ok
ii. Changes in button cancel
Name – btncancel
DialogResult – Cancel
iii. Change in Form Property
Acceptbutton – btnok
Cancelbutton – btncancel.
iv. Change the name of the textboxes as follows
txtDoor,txtSt,txtCity,txtState,txtPin.
4. Coding for Main Form
Button1 (About Button) click event:
AboutFrom abtfrm = new AboutForm();
abtfrm.Show();

You might also like