Download as pdf or txt
Download as pdf or txt
You are on page 1of 78

 

DEPARTMENT OF INFORMATION TECHNOLOGY 
FACULTY OF ENGINEERING & TECHNOLOGY 
 
 
LAB MANUAL 
FOR 
 
SUBJECT: INTEGRATIVE PROGRAMMING &TECHNOLOGY LAB 
SUBJECT CODE: IT0423 
 
 
PREPARED BY 
N.J.SUBASHINI & J.JEYSREE 
Assistant Professor 
Department of Information Technology 
 
 

 
 
 
 
SRM University, SRM Nagar, Kattankulathur‐603203 
Kancheepuram District, Tamil Nadu 
 
IT 0423 –Integrative Programming and Technology LAB 

SYLLABUS 
IT INTEGRATIVE PROGRAMMING AND 0 0 4 2
0423 TECHNOLOGIES LAB
Co requisite
IT 0407 INTEGRATIVE PROGRAMMING AND
TECHNOLOGIES

PURPOSE
This course enables the students to practice and implement various concepts like RMI, JAVA
BEANS, and Web services using EJB.
INSTRUCTIONAL OBJECTIVES
After successful completion of the course, the students should be able to
• Implement distributed application using RMI.
• Implement distributed components such as Java bean, EJB
• Implement Language interoperability program using JNI

LIST OF EXERCISES
JAVA
• Multiple Inheritance
• Frames , Applet and Different Components

JAVA BEAN
• Create a simple bean components using java class and swing class

RMI
• Create a RMI component to reverse a given string from server to client as
requested
• .Create a RMI component to transfer one file from server to client as requested
using web application

JNI
• Object Passing
• Sorting Array
• Exception handling and different data types

ENTERPRISE JAVA BEAN
• Create a session, message driven and entity component
• Create a web services
• Create a design pattern
TOTAL 60
REFERENCE:
1. Integrative Programming and Technologies Lab Manual, Department of Information
Technology, SRM University

Department of Information Technology, SRM University            P a g e  | 2 

 
IT 0423 –Integrative Programming and Technology LAB 

 
LIST OF EXERCISES

1. BASIC JAVA
a. Multiple Inheritance – Employee Detail
b. Event Handling – Leave Application Form
2. RMI
a. File Transfer
b. With Servlet to Perform different arithmetic operation
3. JAVA BEANS
a. Account Details –Using Non-Visual Bean
b. Color Bean – Using Visual Bean
4. JNI
a. Object Passing
b. Sorting Array
c. Different Data Types and Exception handling
5. MSMQ Using VB
a. Passing message using MSMQ

Department of Information Technology, SRM University            P a g e  | 3 

 
IT 0423 –Integrative Programming and Technology LAB 

TABLE OF CONTENT

Sl.No Name of the Experiment Page No


I: BASIC JAVA
1 a. Multiple Inheritance – Employee Detail 5
1 b. Event Handling – Leave Application Form 11
II: REMOTE METHOD INVOCATION –RMI
2 a. File Transfer 17
2 b. With Servlet to Perform different arithmetic operation 22
III:JAVA BEANS
3 a. Account Details –Using Non-Visual Bean 30
3 b. Color Bean – Using Visual Bean 38
IV:JAVA NATIVE INTERFACE-JNI
4 a. Object Passing 41
4 b. Sorting Array 47
4 c. Different Data Types and Exception handling 49
V: MSMQ Using VB
5 1. Passing message using MSMQ 51
Reference 54
Solution Code 55

Department of Information Technology, SRM University            P a g e  | 4 

 
IT 0423 –Integrative Programming and Technology LAB 

EX NO:1A Multiple Inheritance – Employee Detail

Question : Develop a payroll System in JAVA to illustrate the concept of Multiple Inheritance.
Procedure:
1. Design a interface called as “NetPayCalculation” with the following method declarations.
a. void grosspaycalculation();
b. void taxcalculation();
c. float netpaycalculation();

2. Design a simple class called as “Employee” with the following variables & methods
Variables are :-
int ID_No; String Name, DOJ, Designation, PAN_No, Department; float Basic_pay;
Methods are:-
void get_Data() Æ get all the variables defined/mentioned above

3. Design a main class which called “payroll” extends and implements the above
mentioned class & interface respect with following variables & methods.
Variables are:-
float gross-pay, Taxable_amount, Net_pay;
Method :-
void display_details()Æ to display all the details about an employee.

Specifications :-
grosspay calculation method:
Define 2 float variables DA, HRA
Where DA= 50% of basic_pay
HRA= 20% of basic_pay
Gross_pay = sum of DA, HRA & Basic_pay
Tax calculation method:
If the total income for 12 months is between >=1,00,000 & <2,00,000 then
Taxable _amount = 20% of gross_pay
else if > 3,00,000
Taxable_amount = 30% of gross_pay
Netpaycalculation method:
From this method call the grosspay & tax calculation methods and calculate the
Net_pay as gross_pay – taxable_amount;
Return the net_pay
In main() method
create an object & call the get_data() & display_details() methods.

Department of Information Technology, SRM University            P a g e  | 5 

 
IT 0423 –Integrative Programming and Technology LAB 

Solution:

Department of Information Technology, SRM University            P a g e  | 6 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 7 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 8 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 9 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output

Department of Information Technology, SRM University            P a g e  | 10 

 
IT 0423 –Integrative Programming and Technology LAB 

Ex No: 1B Event Handling – Leave Application Form

Question: Develop a Leave Application Form using Swing Components. It should contain a Submit
button and Print button. On clicking submit button no. days the student has applied leave for should be
calculated. On clicking on Print button the details entered by the student should get displayed in another
Frame
Procedure:
1. Design JApplet called “LeaveApplication” with the following components

2. For “Submit” button perform the following operations:


a. Retrieve the values from ‘Text_Dateform’ and ‘Text_Dateto’. Calculate no. of days
between these two dates entered and set this result in ‘Text_applieddays’.
b. Retrieve the value from ‘Text_applieddays’ and ‘Text_availedleave’ and calculate
‘total_leave’. If ‘total_leave’ is >15 then set ‘Label_leaveStatus’ to “Leave is Not
Approved” else “Leave is Approved”.
3. Design a JFrame called “PrintForm” inside the same project with the following components

Department of Information Technology, SRM University            P a g e  | 11 

 
IT 0423 –Integrative Programming and Technology LAB 

4. For “Print” button perform the following


a. Create the object for the JFrame “PrintForm” and call the method defined inside this
“PrintForm” named “printdata()” which takes the following as parameters
i. name from “Text_Name”
ii. dept from “Combo_Department”
iii. leavetype from “List_leave”
iv. appliedLeave from “Text_applieddays”
v. reason from “Textarea_Reason”
vi. status from “Label_leaveStatus”

5. printdata(……) method in ‘PrintForm’ perform following operation:


The passed parameter values are set to different label used in “PrintForm”
i. Lbl_name = name
ii. Lbl_Dept = dept
iii. Lbl_type = leavetype
iv. Lbl_days = appliedleave
v. Lbl_reason = reason
vi. Lbl_status = status
6. The values given in JApplet (LeaveApplication) is retrieved and displayed in
JFrame(PrintForm)

Department of Information Technology, SRM University            P a g e  | 12 

 
IT 0423 –Integrative Programming and Technology LAB 

Solution:

Department of Information Technology, SRM University            P a g e  | 13 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 14 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 15 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output

Department of Information Technology, SRM University            P a g e  | 16 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 2A RMI - File Transfer


Question: Develop a RMI program to transfer a file from Server to the client by getting the filename
from the Client
Procedure:
1. Design an interface termed as “FileRetrieve_Int” with the following method declaration
Byte[ ] downloadFile(String filename)
2. Design a JAVA main class (Server) called as ‘FileRetrieve_Impl’ which implements the above
interface and the operation required to retrieve the file is written inside the method. Also define
the necessary client server connection.
3. Design another JAVA main class (Client) called as “FileRetrieve_Client”, in which the
‘filename’ from the user and either save contents the file retrieved in another file or print the
contents of file retrieved in the output window.
Solution:

Department of Information Technology, SRM University            P a g e  | 17 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 18 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 19 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output : start the server

Department of Information Technology, SRM University            P a g e  | 20 

 
IT 0423 –Integrative Programming and Technology LAB 

Start the client and enter the file name.

Department of Information Technology, SRM University            P a g e  | 21 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 2B RMI -With Servlet to perform different arithmetic operation

Question: Develop a RMI program using servlet to perform different arithmetic operation, by getting the
values from the user through HTML file.
Procedure:
1. Design a interface called as ‘Arithmetic_Interface’ with the following method definition
public double add(double a,double b)
public double sub(double a, double b)
public double div(double a, double b)
public double mul(double a, double b)
public double mod(double a, double b)
2. Create a java main class called as “ArithmeticServer_Impl” which implements the above
interface. Define the necessary connection inside main and define different arithmetic function.
3. Design a HTML page with the <form> tag as given below and name the html file as
‘Arithmetic_Rmi_html’
Note: use <table> tag for proper alignment

4. Create a servlet program ‘ArithmeticClient_Servlet’ as client for requesting the server and
display the result.

Department of Information Technology, SRM University            P a g e  | 22 

 
IT 0423 –Integrative Programming and Technology LAB 

Solution:

Department of Information Technology, SRM University            P a g e  | 23 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 24 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 25 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 26 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 27 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output

Department of Information Technology, SRM University            P a g e  | 28 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 29 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 3A Account Details –Using Non-Visual Bean

Question: Develop a JAVA Bean to calculate the current balance in your account and display the balance
detail as a message using JFrame.
Procedure:
1. Create a java bean class named as ‘AccountDetail_Bean’. Define the following
Properties
a. private String Date
b. private long Acct_no
c. private String Name
d. private double Withdraw_amount
e. private final double Balance_amt = 100000
Methods
a. public void generate_SystemDate( )
It gets the system date and from this call setDate( ) method.
b. public double current_balance( )
This method calculates balance as balance = Balance_amt – withdraw_amount. If
balance_amt is less than Withdraw_amount then return balance_amt itself,
otherwise return the balance calculated.
2. Create another project with java swing Form. In this create a JFrame called as Account_Form.
Design the form with following details.

3. On double clicking the “OK” button


a. Set Accountno,name,Withdraw_amount, values of Bean class by the values entered in the
jtextfield Text_AccountNo, Text-Name and Text_withdraw respectively.
b. Get the balance from the Bean class and set the “Text-balance” jtextfield Box with it.

Department of Information Technology, SRM University            P a g e  | 30 

 
IT 0423 –Integrative Programming and Technology LAB 
c. Calculate the current balance by invoking the method current_balance( ) defined in Bean
class and set the calculated current balance to the label “lbl_Balance”.
4. On double clicking the ‘Message button
5. Display the message as “Balance in your Account no: <acc_no> as on <date> is <balance_amt>”
6. The message should be displayed using JoptionPane.showMessageDialog(null, output, “sms”, 1).
Solution:

Department of Information Technology, SRM University            P a g e  | 31 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 32 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 33 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 34 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 35 

 
IT 0423 –Integrative Programming and Technology LAB 

Department of Information Technology, SRM University            P a g e  | 36 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output:

Department of Information Technology, SRM University            P a g e  | 37 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 3B Color Bean – Using Visual Bean

Question: Create a visual java bean using mouse event for moving a small oval along with the
cursor point.
Procedure:
1. Design a Java Bean class named as “MouseMove_Bean” extends JPanel class.
with properties :- private int Circle_size=20
private int xm, ym ;
method:- private color randomColor() {……}
> used to generate random colors.
[Hint- use predefined color() class Æ takes 3 int org for color() constructor.Math.random() used
to provide random no.]
Overridden methods ( From JPanel)
a. public void paintComponent (Graphics g)
Set the color by calling random color () method & draw the oval with the “Circlesize”
property defined above
b. public Dimension get( )
Return new Dimension (200, 200) for setting the size of the JPanel
Inside the Constructor
a. Set the background for the JPanel (Bean created) and addMouseMotionListener to
perform Mousemoved event.
b. Inside the MouseMoved () event method get the x, y position of the cursor and set it from
xm & ym variables.
Note :- While drawing the oval use xm, ym, circle-size, so that circle moves when xm, ym
changes when mouse is moved.
2.Design a JApplet Form called as “MouseMove_Form”
Here drag & drop the above bean created.
3.Execute the JApplet.

Department of Information Technology, SRM University            P a g e  | 38 

 
IT 0423 –Integrative Programming and Technology LAB 

Solution:

Add properties to the class as stated in the previous exercise, with the class extending JPanel

Add to palette as mentioned in above exercise


Drag and drop the Visual bean from palette

Department of Information Technology, SRM University            P a g e  | 39 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output

Department of Information Technology, SRM University            P a g e  | 40 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 4A JNI - Object Passing

Question: To create a JNI program to pass object as argument from java to c program.
Procedure:
1) Create a Java Application named as “Exercise4_JNI” with a java main class named as
“PassingObject” and a java class named as “SimpleClass”
2) In the “SimpleClass” file do the following
a. Declare a variable int count;
b. Define a method named “Increment()” to increment the count value by 10 as
count=count*10; and print the count value inside the method.
3) In the “PassingObject” class/file do the following
a. Define a native method declaration as follows
public static native void changecountvalue ( SimpleClass sc); and inside the main()
method perform the following
1. Create the obj for SimpleClass as sc,
2. assign the value of count to 10,
3. invoke the Increment() method,
4. invoke changecountvalue by passing ‘sc’ as argument ,
5. print the value of count before and after changecountvalue() method call.
4) Create a C/C++ application project named as “Excercise4_JNI_C” with “PassingObject.c”
file in it.
Create header file & perform the necessary step to change the value of count from c program.

Solution:

Department of Information Technology, SRM University            P a g e  | 41 

 
IT 0423 –Integrative Programming and Technology LAB 

Within this package create a java class file and main class file with native methods

Create Header file as shown below:

Department of Information Technology, SRM University            P a g e  | 42 

 
IT 0423 –Integrative Programming and Technology LAB 

Create C/C++ application as mention

Department of Information Technology, SRM University            P a g e  | 43 

 
IT 0423 –Integrative Programming and Technology LAB 

Set the properties as given below

Department of Information Technology, SRM University            P a g e  | 44 

 
IT 0423 –Integrative Programming and Technology LAB 

After clean and build .dll file will be generated

Load the .dll file in the java main class.

Department of Information Technology, SRM University            P a g e  | 45 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output

Department of Information Technology, SRM University            P a g e  | 46 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 4B JNI – Sorting Array

Question: To create a JNI program to sort the values in an array by using C++ application.
Procedure:
1. Create a java main class named as “Sorting_array” which contain only one native method as
follows
public native int[] ArraySorting (int[] array);
and a static array declaration as
Static int array[];
within the main() method perform the following.
a. get the length of the array
b. now using length create a new array
c. from user get the values for the array
d. call the method ArraySorting (int []) by passing the array values got from the user.
e. assign the return value of ArraySorting() method to a new array variable called as
sorted_array[] and print the sorted_array[] values.

2. create a c/c++ application with “Sorting_Array.cpp” file


create headerfile & perform the necessary step to sort the values either in ascending or
descending order using C++ and return the sorted array to the jave code.

Solution:
Follow the same steps as mentioned in the above program
1. Create a java main class
2. Generate the header file for the java class
3. Create C/C++ applications with necessary codes
4. Set the properties, clean and build to generate the .dll file
5. Load the .dll file in the .java file

Department of Information Technology, SRM University            P a g e  | 47 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample output

Department of Information Technology, SRM University            P a g e  | 48 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 4C JNI – Different Data Types and Exception handling

Question: To create a JNI program to use different types such as int, float, String & Exception
Handling with c program.
1. create a java main class called as “Exception_Difftypes”
Define the following method(s) declaration
a. public native int intMethod (int n);
b. public native Boolean booleanMethod (boolean text)
c. public native string stringMethod (String text);
d. public native void doit() throws IllegalArgumentException;
and the following method definition
e. public void callback () throws NullPointerException
{
throw new NullPointerException(“CatchThrow.callback”)
}
Inside the main () function perform the following
Create the object of the class and invoke the method a, b, c and print the values returned
by them.
In try… catch block call the d & e method.
2. Create a C/C++ application with “Exception_Differenttype.c” file
Create header file & perform the following operation in different method.
a. intMethod () Æ return the product of 2 No’s
b. booleanMethod () Æ return the !boolean value
c. StringMethod () Æ return the uppercase string
d. doit () Æ to throw the exception

Solution:
Follow the same steps as mentioned in the above program
1. Create a java main class
2. Generate the header file for the java class
3. Create C/C++ applications with necessary codes
4. Set the properties, clean and build to generate the .dll file
5. Load the .dll file in the .java file

Department of Information Technology, SRM University            P a g e  | 49 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output

Department of Information Technology, SRM University            P a g e  | 50 

 
IT 0423 –Integrative Programming and Technology LAB 

Exercise 5 Passing message using MSMQ

Question: To create a application using VB for sending message using MSMQ concept

Procedure:
Create a STDEXE VB application named as “QWriter” with the following form design and write
the necessary code to update the message in the MSMQ object

Text box 1 named as txtlabel and text box 2 named as txtbody and command button named as
cmdsend

Create a STDEXE VB application named as “QReader” with the following form design and
write the necessary code to retrieve the message from the MSMQ object

Text Box named as txtLog, Button named as cmdDeleteQ, and a timer named as tmrTerminate
Specification:
ÆDefine a function LOG() to update the textbox with the message from writer.
ÆProvide condition as if message is not received for 30 sec close the Reader form(use timer
object)

Department of Information Technology, SRM University            P a g e  | 51 

 
IT 0423 –Integrative Programming and Technology LAB 

ÆMake the label and button to be visible when last 10 min is left

Department of Information Technology, SRM University            P a g e  | 52 

 
IT 0423 –Integrative Programming and Technology LAB 

Sample Output:

Department of Information Technology, SRM University            P a g e  | 53 

 
IT 0423 –Integrative Programming and Technology LAB 

References:

1. Ash Rofail, Yasser Shohoud, Mastering COM and COM+, BPB Publications, New Delhi
2000.

2. Gerald Bose,Andreas Vogel, Keith Duddy, Java Programming with CORBA, Wiley
Publications, 2003.

3. http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html

4. http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/jniTOC.html

5. http://www.cygwin.com/setup.exe

6. http://www.codeproject.com/KB/COM/

7. http://www.cogin.com/articles/IntroductionToMSMQ.php

Department of Information Technology, SRM University            P a g e  | 54 

 
IT 0423 –Integrative Programming and Technology LAB 

Solution Code

Department of Information Technology, SRM University            P a g e  | 55 

 
IT 0423 –Integrative Programming and Technology LAB 

BASIC JAVA
a. Multiple Inheritance – Employee Detail
b. Event Handling – Leave Application Form

Multiple Inheritance – Employee Detail

NetPayCalculation.java
public interface NetPayCalculation {
void grossPayCalculation();
void taxCalculation();
float netPayCalculation();
}

Employee.java
import java.util.*;
public class Employee {
Scanner s=new Scanner(System.in);
int ID_No;
String Name, DOJ, Designation, Pan_No,Department;
float Basic_Pay;
void get_Data()
{
System.out.println("Enter Employee ID Number: == ");
ID_No=s.nextInt();
System.out.println("Enter Employee Name: ==");s.nextLine();
Name=s.nextLine();
System.out.println("Enter Employee Date of Joining: ==");
DOJ=s.nextLine();
System.out.println("Enter Employee Designation: ==");
Designation=s.nextLine();
System.out.println("Enter Employee Pan Number: ==");
Pan_No=s.nextLine();
System.out.println("Enter Employee Department Name: ==");
Department=s.nextLine();
System.out.println("Enter Employee Basic Pay: ==");
Basic_Pay=s.nextFloat();
}
}
Department of Information Technology, SRM University            P a g e  | 56 

 
IT 0423 –Integrative Programming and Technology LAB 

Payroll.java
public class Payroll extends Employee implements NetPayCalculation{
float Gross_Pay, Taxable_amount,Net_Pay;

public static void main(String[] args) {


Payroll p=new Payroll();
p.get_Data();
p.Display_Details();
}
public void grossPayCalculation() {
float DA=Basic_Pay*50/100;
float HRA=Basic_Pay*20/100;
Gross_Pay=Basic_Pay+DA+HRA;
System.out.println("GP == "+Gross_Pay);
}
public void taxCalculation() {
float Income=Gross_Pay*12;
if(Income >= 100000 && Income < 200000)
{
Taxable_amount=Gross_Pay*10/100;
}
else if(Income>=200000 && Income < 300000)
{
Taxable_amount=Gross_Pay*20/100;
}
else if(Income>=300000)
{
Taxable_amount=Gross_Pay*30/100;
}
System.out.println("TP=="+Taxable_amount);
}
public float netPayCalculation() {
grossPayCalculation();
taxCalculation();
Net_Pay=Gross_Pay-Taxable_amount;
return Net_Pay;
}
public void Display_Details()
{

Department of Information Technology, SRM University            P a g e  | 57 

 
IT 0423 –Integrative Programming and Technology LAB 

System.out.println("Employee ID Number: == "+ID_No);


System.out.println("Employee Name: =="+Name);
System.out.println("Employee Date of Joining: =="+DOJ);
System.out.println("Employee Designation: =="+Designation);
System.out.println("Employee Pan Number: =="+Pan_No);
System.out.println("Employee Department Name: =="+Department);
System.out.println("Employee Net Pay: =="+netPayCalculation());
}
}

Event Handling – Leave Application Form


LeaveApplication.java
import java.util.Calendar;
public class LeaveApplication extends javax.swing.JApplet {
/** Initializes the applet LeaveApplication */
@Override
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
setSize(550, 650);
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void SubmitActionPerformed(java.awt.event.ActionEvent evt) {
String fromdate=Text_Datefrom.getText();
String from[]=fromdate.split("/");
int date=Integer.parseInt(from[0]);
int month=Integer.parseInt(from[1]);
int year=Integer.parseInt(from[2]);
Calendar calendar1 = Calendar.getInstance();
calendar1.set(year, month,date);

String todate=Text_Dateto.getText();
String to[]=todate.split("/");

Department of Information Technology, SRM University            P a g e  | 58 

 
IT 0423 –Integrative Programming and Technology LAB 

int date1=Integer.parseInt(to[0]);
int month1=Integer.parseInt(to[1]);
int year1=Integer.parseInt(to[2]);
Calendar calendar2 = Calendar.getInstance();
calendar2.set(year1, month1,date1);
// Get the represented date in milliseconds
long milis1 = calendar1.getTimeInMillis();
long milis2 = calendar2.getTimeInMillis();
// Calculate difference in milliseconds
long diff = milis2 - milis1;
// Calculate difference in days
long diffDays = diff / (24 * 60 * 60 * 1000);
Long diffday=new Long(diffDays);
Text_applieddays.setText(diffday.toString());
String avalied_leave=Text_availedleave.getText();
int avail_leave=Integer.parseInt(avalied_leave);
long total_availed=diffDays+avail_leave;
if(total_availed>15)
{
Label_Leavestatus.setText("Leave is Not Approved");
}
else
{
Label_Leavestatus.setText("Leave is Approved");
}
}
private void PrintActionPerformed(java.awt.event.ActionEvent evt) {
PrintForm form=new PrintForm();
form.setVisible(true);
String name=Text_Name.getText();
String dept=Combo_Department.getSelectedItem().toString();
String leavetype=LIst_Leave.getSelectedValue().toString();
String appliedleave=Text_applieddays.getText();
String reason=Textarea_Reason.getText();
String status=Label_Leavestatus.getText();
form.printdata(name,dept,leavetype,appliedleave,reason,status);
}
}

Department of Information Technology, SRM University            P a g e  | 59 

 
IT 0423 –Integrative Programming and Technology LAB 

PrintForm.java
public class PrintForm extends javax.swing.JFrame {
/** Creates new form PrintForm */
public PrintForm() {
initComponents();
// String name=LeaveApplication
}
void printdata(String name,String dept,String leavetype,String appliedleave,String
reason,String status)
{
Lbl_name.setText(name);
Lbl_Dept.setText(dept);
Lbl_type.setText(leavetype);
Lbl_days.setText(appliedleave);
Lbl_reason.setText(reason);
Lbl_status.setText(status);

}
}
2. RMI
a. File Transfer
b. With Servlet to Perform different arithmetic operation
File Transfer
FileRetrieve_Int.java
import java.rmi.*;
public interface FileRetrieve_Int extends Remote{
public byte[] downloadFile(String fileName) throws RemoteException;
}

FileRetrieve_Impl.java
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class FileRetrieve_Impl extends UnicastRemoteObject implements FileRetrieve_Int {
public FileRetrieve_Impl() throws RemoteException{
}

Department of Information Technology, SRM University            P a g e  | 60 

 
IT 0423 –Integrative Programming and Technology LAB 

public byte[] downloadFile(String fileName){


try {
File file = new File(fileName);
byte buffer[] = new byte[(int)file.length()];
BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
input.read(buffer,0,buffer.length);
input.close();
return(buffer);
} catch(Exception e){
System.out.println("FileImpl: "+e.getMessage());
e.printStackTrace();
return(null);
}
}
public static void main(String[] args) {
try {
FileRetrieve_Impl fi = new FileRetrieve_Impl();
Registry registry = LocateRegistry.createRegistry(1099);
registry.rebind("FileServer", fi);
System.out.println("Started......");
} catch(Exception e) {
System.out.println("FileServer: "+e.getMessage());
e.printStackTrace();
}
}
}
FileRetrieve_Client.java
import java.rmi.*;
import java.io.*;
import java.util.*;
public class FileRetrieve_Client {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
try {
String name = "rmi://localhost/FileServer";
FileRetrieve_Int fi = (FileRetrieve_Int) Naming.lookup(name);
System.out.println("Enter the file name with correct path.....");
String filename=sc.next();
byte[] filedata = fi.downloadFile(filename);

Department of Information Technology, SRM University            P a g e  | 61 

 
IT 0423 –Integrative Programming and Technology LAB 

File file = new File("filename.txt");


BufferedOutputStream output = new
BufferedOutputStream(new FileOutputStream(file.getName()));
output.write(filedata,0,filedata.length);
output.flush();
output.close();
} catch(Exception e) {
System.err.println("FileServer exception: "+ e.getMessage());
e.printStackTrace();
}
}
}

RMI with Servlet to Perform different arithmetic operation


Arithmetic_Rmi_html.html
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form name="Form1"
method="post"
action="http://localhost:8080/Exercise3/ArithmeticClient_Servlet">
<table>
<tr>
<td><B/>Enter First Number</td>
<td><input type=textbox name="Num1" size="25" value=""></td>
</tr>
<tr>
<td><B/>Enter Second Number</td>
<td><input type=textbox name="Num2" size="25" value=""></td>
</tr>
</table>
<input type=submit value="Submit">
</form>
</body>
</html>

Department of Information Technology, SRM University            P a g e  | 62 

 
IT 0423 –Integrative Programming and Technology LAB 

Arithmetic_interface.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Arithmetic_interface extends Remote
{
public double add(double a, double b) throws RemoteException;
public double sub(double a, double b) throws RemoteException;
public double mul(double a, double b) throws RemoteException;
public double div(double a, double b) throws RemoteException;
public double mod(double a, double b) throws RemoteException;
}

ArithmeticServer_Impl.java
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class ArithmeticServer_Impl extends UnicastRemoteObject implements
Arithmetic_interface{
public ArithmeticServer_Impl() throws RemoteException{
}
public static void main(String[] args) {
ArithmeticServer_Impl server = null;
try {
server = new ArithmeticServer_Impl();
Registry registry = LocateRegistry.createRegistry(1099);// default:1099
registry.rebind("RemoteObject", server);
System.out.println("Server started..........");
}catch(Exception e){ e.printStackTrace(); }
}
@Override
public double add(double a, double b) throws RemoteException {
return (a+b);
}
@Override
public double sub(double a, double b) throws RemoteException {
return(a-b);
}
@Override

Department of Information Technology, SRM University            P a g e  | 63 

 
IT 0423 –Integrative Programming and Technology LAB 

public double mul(double a, double b) throws RemoteException {


return(a*b);
}
@Override
public double div(double a, double b) throws RemoteException {
return(a/b);
}
@Override
public double mod(double a, double b) throws RemoteException {
return(a%b);
}
}
ArithmeticClient_Servlet.java

import java.io.IOException;
import java.io.PrintWriter;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name="ArithmeticClient_Servlet", urlPatterns={"/ArithmeticClient_Servlet"})
public class ArithmeticClient_Servlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
Arithmetic_interface obj = null;
try {
obj = (Arithmetic_interface)(Naming.lookup("rmi://localhost:1099/RemoteObject"));
} catch (NotBoundException e) {
e.printStackTrace();
}
String s1=request.getParameter("Num1");
String s2=request.getParameter("Num2");
response.setContentType("text/html;charset=UTF-8");

Department of Information Technology, SRM University            P a g e  | 64 

 
IT 0423 –Integrative Programming and Technology LAB 

double num1=Double.parseDouble(s1);
double num2=Double.parseDouble(s2);
out.println("<b>Sum of Two Numbers === </b>"+ obj.add(num1, num2));
out.println("<br><b>Difference between two Numbers === </b>"+ obj.sub(num1, num2));
out.println("<br><b>Product of Two Numbers === </b>"+ obj.mul(num1, num2));
out.println("<br><b>Division of Two Numbers === </b>"+ obj.div(num1, num2));
out.println("<br><b>Modulus of Two Numbers === </b>"+ obj.mod(num1, num2));
} finally {
out.close();
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}
}
3. JAVA BEANS
a. Account Details –Using Non-Visual Bean
b. Color Bean – Using Visual Bean
Account Details –Using Non-Visual Bean
AccountDetail_Bean.java
import java.util.Calendar;
import java.util.GregorianCalendar;
public class AccountDetail_Bean {
private String Date;
private long Acct_no;
private String Name;
private final double Balance_amt = 100000;
private double Withdraw_amount;

Department of Information Technology, SRM University            P a g e  | 65 

 
IT 0423 –Integrative Programming and Technology LAB 

public double getWithdraw_amount() {


return Withdraw_amount;
}
public void setWithdraw_amount(double Withdraw_amount) {
this.Withdraw_amount = Withdraw_amount;
}

public double getBalance_amt() {


return Balance_amt;
}
public String getName() {
return Name;
}

public void setName(String Name) {


this.Name = Name;
}
public long getAcct_no() {
return Acct_no;
}
public void setAcct_no(long Acct_no) {
this.Acct_no = Acct_no;
}
public String getDate() {
return Date;
}
public void setDate(String Date) {
this.Date = Date;
}
public void generate_SystemDate()
{
Calendar cal = new GregorianCalendar();
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DAY_OF_MONTH);
setDate("Date is : " + day + "/" + (month + 1) + "/" + year);
}
public double current_Balance()

Department of Information Technology, SRM University            P a g e  | 66 

 
IT 0423 –Integrative Programming and Technology LAB 

{
double balance = Balance_amt-Withdraw_amount;
if(Withdraw_amount>Balance_amt)
{
return Balance_amt;
}
else
{
return balance;
}
}
}
Account_form.java

import javax.swing.JOptionPane;
public class Account_form extends javax.swing.JFrame {
public Account_form() {
setSize(500, 650);
initComponents();
accountDetail_Bean1.generate_SystemDate();
Lbl_date.setText(accountDetail_Bean1.getDate());

}
private void Button_OKActionPerformed(java.awt.event.ActionEvent evt) {
accountDetail_Bean1.setName(Text_name.getText());
accountDetail_Bean1.setAcct_no(Long.parseLong(Text_AccountNo.getText()));
double bala=accountDetail_Bean1.getBalance_amt();
Double balance = new Double(bala);
Text_balance.setText(balance.toString());
accountDetail_Bean1.setWithdraw_amount(Double.parseDouble(Text_Withdraw.getText()));
double current_balance=accountDetail_Bean1.current_Balance();
Double current_bala = new Double(current_balance);
Lbl_Balance.setText("Current Balance is=="+current_bala.toString());
}

private void Button_MsgActionPerformed(java.awt.event.ActionEvent evt) {


String Message="Balance in your Account No:"+accountDetail_Bean1.getAcct_no()+
" as on "+ Lbl_date.getText()+" is :"+ accountDetail_Bean1.getBalance_amt();
JOptionPane.showMessageDialog(null, Message, "SMS", 1);

Department of Information Technology, SRM University            P a g e  | 67 

 
IT 0423 –Integrative Programming and Technology LAB 

public static void main(String args[]) {


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Account_form().setVisible(true);
}
});
}
}
Color Bean – Using Visual Bean
MouseMove_Bean.java
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JPanel;

public class MouseMove_Bean extends JPanel


{
private int Circle_Size=20;
private int xm,ym;
public int getCircle_Size() {
return Circle_Size;
}
public void setCircle_Size(int Circle_Size) {
this.Circle_Size = Circle_Size;
}
private Color randomcolor()
{
int r=(int)(255*Math.random());
int g=(int)(255*Math.random());
int b=(int)(255*Math.random());
return new Color(r,g,b);
}
@Override
public void paintComponent(Graphics g)
{

Department of Information Technology, SRM University            P a g e  | 68 

 
IT 0423 –Integrative Programming and Technology LAB 

super.paintComponent(g);
g.setColor(randomcolor());
g.fillOval(xm - Circle_Size/2, ym - Circle_Size/2, Circle_Size, Circle_Size);
}
public MouseMove_Bean()
{
setBackground(Color.CYAN);
addMouseMotionListener (new MouseAdapter()
{
@Override
public void mouseMoved(MouseEvent me)
{
xm = me.getX();

ym = me.getY();
repaint();
}
});

}
@Override
public Dimension getPreferredSize()
{
return new Dimension(200, 200);
}

Create a file named as Mousemove_form.java and drag and drop the bean added to the pallete

4. JNI
a. Object Passing
b. Sorting Array
c. Different Data Types and Exception handling
Object Passing
SimpleClass.java
package exercise6_jni;
public class SimpleClass {
int count;

Department of Information Technology, SRM University            P a g e  | 69 

 
IT 0423 –Integrative Programming and Technology LAB 

public void Increment()


{
count=count*10;
System.out.println("Count Value in Simple Class ---"+count);
}
}
PassingObject.java
package exercise6_jni;
public class PassingObject {
static
{
System.load("E:\\INTEGRATIVE PROGRAMMING AND TECHNOLOGIES\\IT0407 -
IPT\\LAB\\Exercise6_JNI_C_Program\\dllfile\\objpass.dll");
}
public static native void changecountvalue(SimpleClass sc);
public static void main(String[] args) {
SimpleClass Sc = new SimpleClass();
Sc.count=10;
System.out.println("Count value inside Passing object clas=="+Sc.count);
System.out.println("Calling the function in Simple Class---");
Sc.Increment();
System.out.println("Calling the native function ---");
changecountvalue(Sc);
System.out.println("After calling native Count value is ==== " + Sc.count);
}
}
PassingObject.c
#include <stdio.h>
#include <stdlib.h>
#include "jni.h"
#include "Headerfile.h"
JNIEXPORT void JNICALL Java_exercise6_1jni_PassingObject_changecountvalue
(JNIEnv *env, jclass jobj, jobject obj)
{
jclass cls = (*env)->GetObjectClass(env, obj);
jfieldID fid = (*env)->GetFieldID(env, cls,"count", "I");
jmethodID mid = (*env)->GetMethodID(env, cls,"Increment", "()V");
int value = (*env)->GetIntField(env,obj, fid);
printf("\nNative value 1....: %d\n", value);

Department of Information Technology, SRM University            P a g e  | 70 

 
IT 0423 –Integrative Programming and Technology LAB 

(*env)->SetIntField(env, obj, fid, value);


(*env)->CallVoidMethod(env,obj, mid);
value = (*env)->GetIntField(env,obj, fid);
printf("\nNative value 2....: %d\n", value);
}
int main(int argc, char** argv) {
return (EXIT_SUCCESS);
}
Sorting Array
Sorting_array.java
package exercise6_jni;

import java.util.Scanner;
public class Sorting_array {
static int array[];
static
{
System.load("E:\\INTEGRATIVE PROGRAMMING AND TECHNOLOGIES\\IT0407 -
IPT\\LAB\\Exercise6_JNI_CPP_Program\\DLLFile\\sort.dll");
}
public native int[] ArraySorting(int[] array);
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter number of elements to be sorted...");
int array_length=sc.nextInt();
array=new int[array_length];
System.out.println("Enter the array elements...");
for(int i=0;i<array_length;i++)
{
array[i]=sc.nextInt();
}

int sorted_array[]=new Sorting_array().ArraySorting(array);


System.out.println("After Sorting...");
for(int i=0;i<sorted_array.length;i++)
{
System.out.println(sorted_array[i]);
}
}

Department of Information Technology, SRM University            P a g e  | 71 

 
IT 0423 –Integrative Programming and Technology LAB 

}
Sorting_array.cpp
#include <cstdlib>
#include "jni.h"
#include "Headerfile.h"
#include <iostream.h>
using namespace std;
int main(int argc, char** argv) {
return 0;
}
JNIEXPORT jintArray JNICALL Java_exercise6_1jni_Sorting_1array_ArraySorting
(JNIEnv *env, jobject obj, jintArray array)
{
int i,temp;
jsize len=(env)->GetArrayLength(array);
jint *body=(env)->GetIntArrayElements(array,0);
//jintArray res=(*env)->GetIntArrayElements()
for (i=0; i<len; i++)
{
for(int j=0;j<len;j++)
{
if(body[i]>body[j])
{
temp=body[i];
body[i]=body[j];
body[j]=temp;

}
}
}
cout<<"C++ sorting\n";
for(i=0;i<len;i++)
{
cout<<body[i]<<"\n";
}
jintArray result = env->NewIntArray(len);
env->SetIntArrayRegion(result, 0, len, body);
return result;

Department of Information Technology, SRM University            P a g e  | 72 

 
IT 0423 –Integrative Programming and Technology LAB 

}
Different Data Types and Exception handling
Exception_Difftypes.java
package exercise6_jni;
public class Exception_Difftypes {
static
{
System.load("E:\\INTEGRATIVE PROGRAMMING AND TECHNOLOGIES\\IT0407 -
IPT\\LAB\\Exercise6_JNI_Exp_dt\\dist\\expdt.dll");
}

public native int intMethod(int n);


public native boolean booleanMethod(boolean bool);
public native String stringMethod(String text);
private native void doit() throws IllegalArgumentException;
private void callback() throws NullPointerException {
throw new NullPointerException("CatchThrow.callback");
}

public static void main(String[] args) {


Exception_Difftypes edt=new Exception_Difftypes();
int square = edt.intMethod(5);
boolean bool = edt.booleanMethod(true);
String text = edt.stringMethod("Java");
System.out.println("intMethod: " + square);
System.out.println("booleanMethod: " + bool);
System.out.println("stringMethod: " + text);
try {

edt.callback();
} catch (Exception e) {
System.out.println("In Java1:\n\t" + e);
}
try {
edt.doit();

} catch (Exception e) {
System.out.println("In Java2:\n\t" + e);
}

Department of Information Technology, SRM University            P a g e  | 73 

 
IT 0423 –Integrative Programming and Technology LAB 

}
}
Exception_differenttypes.c
#include <stdio.h>
#include <stdlib.h>
#include "jni.h"
#include "Header.h"
#include <string.h>
int main(int argc, char** argv) {
return (EXIT_SUCCESS);
}
JNIEXPORT jint JNICALL Java_exercise6_1jni_Exception_1Difftypes_intMethod
(JNIEnv *env, jobject obj, jint num)
{
return num * num;
}
JNIEXPORT jboolean JNICALL Java_exercise6_1jni_Exception_1Difftypes_booleanMethod
(JNIEnv *env, jobject obj, jboolean jbool)
{
return !jbool;
}
JNIEXPORT jstring JNICALL Java_exercise6_1jni_Exception_1Difftypes_stringMethod
(JNIEnv *env, jobject jobj, jstring string)
{
const char *str = (*env)->GetStringUTFChars(env, string, 0);
char cap[128];
strcpy(cap, str);
(*env)->ReleaseStringUTFChars(env, string, str);
return (*env)->NewStringUTF(env, strupr(cap));
}
JNIEXPORT void JNICALL Java_exercise6_1jni_Exception_1Difftypes_doit
(JNIEnv *env, jobject obj)
{
jthrowable exc;
jclass cls = (*env)->GetObjectClass(env, obj);
jmethodID mid =(*env)->GetMethodID(env, cls, "callback", "()V");
(*env)->CallVoidMethod(env, obj, mid);
exc = (*env)->ExceptionOccurred(env);
if (exc) {

Department of Information Technology, SRM University            P a g e  | 74 

 
IT 0423 –Integrative Programming and Technology LAB 

jclass newExcCls;
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
newExcCls = (*env)->FindClass(env,"java/lang/IllegalArgumentException");
if (newExcCls == NULL) {
return;
}
(*env)->ThrowNew(env, newExcCls, "thrown from C code");
}
}

5. MSMQ Using VB
a. Passing message using MSMQ
Passing message using MSMQ
QReader.vbp
Main.frm(source code)

Option Explicit

Private Const TIMEOUTSECS = 30

Private WithEvents qeventIn As MSMQ.MSMQEvent


Private qIn As MSMQ.MSMQQueue
Private qinfoIn As New MSMQ.MSMQQueueInfo

Private Sub Log(ByVal Text As String)


With txtLog
.SelStart = Len(.Text)
.SelText = Text & vbNewLine
.SelStart = Len(.Text)
End With
End Sub

Private Sub cmdDeleteQ_Click()


qinfoIn.Delete
cmdDeleteQ.Enabled = False
End Sub

Private Sub Form_Load()


Department of Information Technology, SRM University            P a g e  | 75 

 
IT 0423 –Integrative Programming and Technology LAB 

qinfoIn.PathName = ".\PRIVATE$\TestQ"
On Error Resume Next
qinfoIn.Create
If Err.Number = MQ_ERROR_QUEUE_EXISTS Then
Log "*Test queue already exists*"
ElseIf Err.Number <> 0 Then
Log "*Queue creation error: " & Hex$(Err.Number) & " " & Err.Description & "*"
Else
Log "*Test queue created*"
End If
On Error GoTo 0

Set qIn = qinfoIn.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)


Set qeventIn = New MSMQ.MSMQEvent
qIn.EnableNotification qeventIn, MSMQ.MQMSGCURSOR.MQMSG_FIRST,
TIMEOUTSECS * 1000
Log "*Started, will time out after " & CStr(TIMEOUTSECS) & " seconds*"
End Sub

Private Sub Form_Unload(Cancel As Integer)


qIn.Close
End Sub

Private Sub qeventIn_Arrived(ByVal Queue As Object, ByVal Cursor As Long)


Dim msgRcvd As MSMQ.MSMQMessage

On Error Resume Next


Set msgRcvd = Queue.Receive(MQ_NO_TRANSACTION, False, True, 0, False)
If Err.Number = 0 Then
Log msgRcvd.Label & ": " & msgRcvd.Body
Queue.EnableNotification _
qeventIn, MSMQ.MQMSGCURSOR.MQMSG_FIRST, TIMEOUTSECS * 1000
Else
Log "*ReceiveError: " & Hex$(Err.Number) & " " & Err.Description
End If
End Sub

Private Sub qeventIn_ArrivedError(ByVal Queue As Object, ByVal ErrorCode As Long, ByVal


Cursor As Long)

Department of Information Technology, SRM University            P a g e  | 76 

 
IT 0423 –Integrative Programming and Technology LAB 

If ErrorCode = MQ_ERROR_IO_TIMEOUT Then


Log "*Timed out, terminating in 10 seconds*"
lblDeleteQ.Visible = True
cmdDeleteQ.Visible = True
Beep
tmrTerminate.Interval = 10000
tmrTerminate.Enabled = True
Else
Log "*ArrivedError: " & Hex$(ErrorCode) & "*"
End If
End Sub

Private Sub tmrTerminate_Timer()


tmrTerminate.Enabled = False
Unload Me
End Sub

QWriter.vbp
Main.frm (source code)
Option Explicit

Private destOut As New MSMQ.MSMQDestination

Private Sub cmdSend_Click()


Dim msgOut As New MSMQ.MSMQMessage

With msgOut
.Label = txtLabel.Text
.Body = txtBody.Text
.Send destOut, MQ_NO_TRANSACTION
End With
txtLabel.Text = ""
txtBody.Text = ""
txtLabel.SetFocus
End Sub

Private Sub Form_Load()


With destOut
.FormatName = "DIRECT=OS:.\PRIVATE$\TestQ"

Department of Information Technology, SRM University            P a g e  | 77 

 
IT 0423 –Integrative Programming and Technology LAB 

.Open
End With
End Sub

Private Sub Form_Unload(Cancel As Integer)


destOut.Close
End Sub

Department of Information Technology, SRM University            P a g e  | 78 

You might also like