scvagadiya.files.wordpress.com … · web viewcreate a program to demonstrate the use of...
TRANSCRIPT
![Page 1: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/1.jpg)
Advance .Net Technology (170707)
Practical:-3
Aim: - Create a Program to demonstrate the Use of Inheritance in VB.NET
Program:
Module Module1
Public Class class1
Public Sub print()
Console.WriteLine("Base class") Console.WriteLine("print") Console.WriteLine("*********************") End Sub
End Class
Public Class class2 Inherits class1
Public Sub display() Console.WriteLine("--------------------------") Console.WriteLine("Child class") Console.WriteLine("display") End Sub
End Class
Sub Main() Console.WriteLine("Inheritance in vb.net") Dim o As New class1() o.print() Dim c As New class2 c.print() c.display() Console.ReadLine()
End Sub
End Module
VIMAT/BE/CE/120940107018
![Page 2: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/2.jpg)
Advance .Net Technology (170707)
Output:-
VIMAT/BE/CE/120940107018
![Page 3: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/3.jpg)
Advance .Net Technology (170707)
Practical:-4
Aim: - Write a Program for Constructor and Destructor using VB.NET.
Program
Imports System.ConsoleModule Module1
Sub Main() Dim con As New Constructor(20) WriteLine("Constructor return age which is....:") WriteLine(con.ShowAge()) 'storing a value in the constructor by passing a value(20) and calling it with the ShowAge method Dim obj As New Destroy() Read()
End Sub
End Module
Public Class Constructor Public Age As Integer
Public Sub New(ByVal x As Integer) 'constructor Age = x 'storing the value of Age in constructor End Sub
Public Function ShowAge() As Integer Return Age 'returning the stored value End Function
End ClassPublic Class Destroy
Protected Overrides Sub Finalize() 'creating a Destrustor Write("VB.NET") Read() End SubEnd Class
VIMAT/BE/CE/120940107018
![Page 4: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/4.jpg)
Advance .Net Technology (170707)
Output:-
Practical:-5
VIMAT/BE/CE/120940107018
![Page 5: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/5.jpg)
Advance .Net Technology (170707)
Aim: -Create Application using VB.Net Use the following Controls: Forms Property Text Box Button Message Box Tooltips Events Tab Order
Program
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "ABC" And TextBox2.Text = "123" Then MsgBox("Succesfully Login") Else MsgBox("Login Fail") End If End SubEnd Class
Output:-
Practical:-6
VIMAT/BE/CE/120940107018
![Page 6: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/6.jpg)
Advance .Net Technology (170707)
Aim: - Create Application using VB.Net Use the following Controls:
a. List Boxb. Combo Boxc. Check Boxd. Option Buttone. Menu
Program
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dept As String dept = ListBox1.SelectedItem Label6.Text = "Selected department is.." + dept
Dim clg As String clg = ComboBox1.SelectedItem Label7.Text = "Selected collage is.." + clg
Dim a, b As String a = RadioButton1.Text b = RadioButton2.Text If RadioButton1.Checked Then Label1.Text = "gender is.." + a Else Label1.Text = "gender is.." + b End If
If CheckBox1.Checked = True Then Label8.Text = "Hobbies are.." + CheckBox1.Text End If
If CheckBox2.Checked = True Then Label8.Text &= "," + CheckBox2.Text End If
If CheckBox3.Checked = True Then Label8.Text &= "," + CheckBox3.Text End If
If CheckBox4.Checked = True Then
VIMAT/BE/CE/120940107018
![Page 7: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/7.jpg)
Advance .Net Technology (170707)
Label8.Text &= "," + CheckBox4.Text End If
If CheckBox5.Checked = True Then Label8.Text &= "," + CheckBox5.Text End If
If CheckBox6.Checked = True Then Label8.Text &= "," + CheckBox6.Text End If
If CheckBox7.Checked = True Then Label8.Text &= "," + CheckBox7.Text End If End SubEnd Class
Output:-
Practical:-7
Aim: - Implement MDI Form which demonstrates use of all Child Forms.
VIMAT/BE/CE/120940107018
![Page 8: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/8.jpg)
Advance .Net Technology (170707)
Program
Form1.vb
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim windows1 As New Form2 windows1.MdiParent = Me windows1.Show()
End SubEnd Class
Form2.vb
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close()
End SubEnd Class
Output:-
VIMAT/BE/CE/120940107018
![Page 9: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/9.jpg)
Advance .Net Technology (170707)
VIMAT/BE/CE/120940107018
![Page 10: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/10.jpg)
Advance .Net Technology (170707)
Practical:-9
Aim: - Create Application which calculate simple Interest and Compound Interest.
Program
Public Class Form1
Private Sub btnExit_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnExit.Click End End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim principal, years As Integer Dim rate, interest, amount As Single
principal = txtPrincipal.Text years = txtYears.Text rate = txtRate.Text
If rbSimpleInterest.Checked = True Then interest = (principal * years * rate) / 100 Else amount = principal * Math.Pow((1 + rate / 100), years) interest = amount - principal End If txtInterest.Text = interest End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click txtPrincipal.Text = " " txtYears.Text = " " txtRate.Text = " " txtInterest.Text = " " End SubEnd Class
VIMAT/BE/CE/120940107018
![Page 11: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/11.jpg)
Advance .Net Technology (170707)
Output:-
Practical:-10
VIMAT/BE/CE/120940107018
![Page 12: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/12.jpg)
Advance .Net Technology (170707)
Aim: - Implement Window Form based Application that includes functionality Insert, Update, Delete and Display Records of Database.
Program
Imports System.Data.SqlClient
Public Class Form1
Dim con As New SqlConnection Dim cmd As New SqlCommand Dim myAdapter As SqlDataAdapter Dim myDataSet As DataSet
Private Sub btInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btInsert.Click con.ConnectionString = "Data Source=ADMIN-PC;Initial Catalog=Emp;Integrated Security=True"
con.Open()
cmd.Connection = con cmd.CommandText = "INSERT INTO emp (Emp_id, Emp_name, Emp_address, Emp_phone) VALUES (@ID,@Name,@Address,@Phone)"
cmd.Parameters.AddWithValue("@ID", TextBox1.Text) cmd.Parameters.AddWithValue("@Name", TextBox2.Text) cmd.Parameters.AddWithValue("@Address", TextBox3.Text) cmd.Parameters.AddWithValue("@Phone", TextBox4.Text) cmd.ExecuteNonQuery()
con.Close()
MsgBox("Added Successfully") End Sub
Private Sub btDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDisplay.Click DataGridView1.Show() con.ConnectionString = "Data Source=ADMIN-PC;Initial Catalog=Emp;Integrated Security=True"
con.Open()
cmd.Connection = con
VIMAT/BE/CE/120940107018
![Page 13: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/13.jpg)
Advance .Net Technology (170707)
cmd.CommandText = " SELECT * FROM emp "
myDataSet = New DataSet()
'Instantiate DataAdapter object myAdapter = New SqlDataAdapter()
'Set DataAdapter command properties myAdapter.SelectCommand = cmd
'Populate the Dataset myAdapter.Fill(myDataSet, "emp")
If (myDataSet.Tables("emp").Rows.Count = 0) Then MessageBox.Show("There are currently no registries in the database.") Else DataGridView1.DataSource = myDataSet.Tables("emp") End If
cmd.ExecuteNonQuery()
con.Close() End Sub
Private Sub btDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDelete.Click con.ConnectionString = "Data Source=ADMIN-PC;Initial Catalog=Emp;Integrated Security=True"
con.Open()
cmd.Connection = con cmd.CommandText = "Delete From emp where Emp_id='" & TextBox1.Text & "' "
cmd.Parameters.AddWithValue("@ID", TextBox1.Text) cmd.Parameters.AddWithValue("@Name", TextBox2.Text) cmd.Parameters.AddWithValue("@Address", TextBox3.Text) cmd.Parameters.AddWithValue("@Phone", TextBox4.Text)
cmd.ExecuteNonQuery() MsgBox(" delete Sucecessfully") con.Close() End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
VIMAT/BE/CE/120940107018
![Page 14: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/14.jpg)
Advance .Net Technology (170707)
DataGridView1.Hide()
End Sub
Private Sub btUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btUpdate.Click con.ConnectionString = "Data Source=ADMIN-PC;Initial Catalog=Emp;Integrated Security=True"
con.Open()
cmd.Connection = con cmd.CommandText = "update emp set Emp_id = '" & TextBox1.Text & "', " & " Emp_name = '" & TextBox2.Text & "', " & " Emp_address ='" & TextBox3.Text & "'," & "Emp_phone = '" & TextBox4.Text & "' where Emp_id = '" & TextBox1.Text & "'"
cmd.Parameters.AddWithValue("@ID", TextBox1.Text) cmd.Parameters.AddWithValue("@Name", TextBox2.Text) cmd.Parameters.AddWithValue("@Address", TextBox3.Text) cmd.Parameters.AddWithValue("@Phone", TextBox4.Text)
cmd.ExecuteNonQuery()
con.Close()
MsgBox("update Successfully")
End SubEnd Class
Output:-
VIMAT/BE/CE/120940107018
![Page 15: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/15.jpg)
Advance .Net Technology (170707)
Practical:-11
VIMAT/BE/CE/120940107018
![Page 16: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/16.jpg)
Advance .Net Technology (170707)
Aim: - Implement Application Using GDI+.
Program
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) {
} protected override void OnPaint(PaintEventArgs args) { //Get the Graphics object from PaintEventArgs Graphics g = args.Graphics; //Draw rectangle g.DrawRectangle( new Pen(Color.Blue, 3), new Rectangle(10, 10, 50, 50)); //Fill ellipse g.FillEllipse( Brushes.Red, new Rectangle(60, 60, 100, 100)); //Draw text g.DrawString("Text", new Font("Verdana", 14), new SolidBrush(Color.Green), 200, 200); } }}
VIMAT/BE/CE/120940107018
![Page 17: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/17.jpg)
Advance .Net Technology (170707)
Output:-
Practical:-13
VIMAT/BE/CE/120940107018
![Page 18: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/18.jpg)
Advance .Net Technology (170707)
Aim: Write a program to create a class which implements Constructors, Destructors, Overloading and overriding concepts using C#.
Program:
using System;using System.Collections.Generic;using System.Linq;using System.Text;
namespace ConsoleApplication1{ class Base { public Base() { int a = 10; Console.WriteLine("Constructor(no args) Result : " + a); Console.WriteLine("--------------------------------------"); } public Base(int b) { int a = b; Console.WriteLine("Constructor(with args) Result : " + a); Console.WriteLine("--------------------------------------"); }
public void circle() { float r = 6; Double a = 3.14 * r * r; Console.WriteLine("Method(no args) Circle1 Result : " + a); Console.WriteLine("--------------------------------------"); } public void circle(float b) { float r = b; Double a = 3.14 * r * r; Console.WriteLine("Method(With args) Circle2 Result : " + a); Console.WriteLine("--------------------------------------"); }
public virtual void circle(String f_name, String l_name) { Console.WriteLine("Base Method : ");
VIMAT/BE/CE/120940107018
![Page 19: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/19.jpg)
Advance .Net Technology (170707)
Console.WriteLine(f_name + " " + l_name); Console.WriteLine("--------------------------------------"); }
~Base() { Console.WriteLine("Its Distructor..."); Console.ReadLine(); }
} class Child : Base { public void circle() { float r = 6; Double a = 3.14 * r * r; Console.WriteLine("Method override(no args) Result : " + a); Console.WriteLine("--------------------------------------"); } public override void circle(String f_name, String l_name) { Console.WriteLine("Override Method : "); Console.WriteLine(f_name + " " + l_name); Console.WriteLine("--------------------------------------"); } }
class Program { public static void Main(string[] args) { Base ob1 = new Base(); Base ob2 = new Base(10);
ob1.circle(); ob1.circle(20);
ob1 = new Child(); ob1.circle(); ob1.circle("KRISHNA", "MODI"); Console.ReadLine(); } }}
VIMAT/BE/CE/120940107018
![Page 20: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/20.jpg)
Advance .Net Technology (170707)
Output:
VIMAT/BE/CE/120940107018
![Page 21: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/21.jpg)
Advance .Net Technology (170707)
Practical:-14
Aim: Use Events and delegates in C# application.
Program:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;
namespace ConsoleApplication1{ //public delegate void SimpleDelegate();
public class EventTest { public event BoilerLogHandler BoilerEventLog; public delegate void BoilerLogHandler(string status); private int value;
public delegate void NumManipulationHandler();
public event NumManipulationHandler ChangeNum;
protected virtual void OnNumChanged() { if (ChangeNum != null) { ChangeNum(); } else { Console.WriteLine("Event fired!"); }
} public EventTest(int n) { SetValue(n); } public void SetValue(int n) { if (value != n)
VIMAT/BE/CE/120940107018
![Page 22: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/22.jpg)
Advance .Net Technology (170707)
{ value = n; OnNumChanged(); } }
class TestDelegate {
/*public static void MyFunc() { Console.WriteLine("I was called by delegate ..."); }*/
static void Main(string[] args) { EventTest e = new EventTest(5); e.SetValue(7); e.SetValue(11); Console.ReadKey(); /* // Instantiation SimpleDelegate simpleDelegate = new SimpleDelegate(MyFunc);
// Invocation simpleDelegate();*/ Console.ReadLine(); } } }}
Output:
VIMAT/BE/CE/120940107018
![Page 23: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/23.jpg)
Advance .Net Technology (170707)
Practical:-15
VIMAT/BE/CE/120940107018
![Page 24: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/24.jpg)
Advance .Net Technology (170707)
Aim: Design Student Registration from Using ASP.Net.
Program:
Default.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication6._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div> <table border="0" cellpadding="0" cellspacing="0"> <tr> <th colspan="3"> Registration </th> </tr> <tr> <td> Username </td> <td> <asp:TextBox ID="txtUsername" runat="server" /> </td> <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ErrorMessage="Required" ForeColor="Red" ControlToValidate="txtUsername" runat="server" /> </td> </tr> <tr> <td> Password </td> <td>
VIMAT/BE/CE/120940107018
![Page 25: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/25.jpg)
Advance .Net Technology (170707)
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /> </td> <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ErrorMessage="Required" ForeColor="Red" ControlToValidate="txtPassword" runat="server" /> </td> </tr> <tr> <td> Confirm Password </td> <td> <asp:TextBox ID="txtConfirmPassword" runat="server" TextMode="Password" /> </td> <td> <asp:CompareValidator ID="CompareValidator1" ErrorMessage="Passwords do not match." ForeColor="Red" ControlToCompare="txtPassword" ControlToValidate="txtConfirmPassword" runat="server" /> </td> </tr> <tr> <td> Email </td> <td> <asp:TextBox ID="txtEmail" runat="server" /> </td> <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ErrorMessage="Required" Display="Dynamic" ForeColor="Red" ControlToValidate="txtEmail" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="txtEmail" ForeColor="Red" ErrorMessage="Invalid email address." /> </td> </tr> <tr> <td> </td> <td> <asp:Button ID="Button1" Text="Submit" runat="server" OnClick="RegisterUser" /> </td> <td> </td>
VIMAT/BE/CE/120940107018
![Page 26: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/26.jpg)
Advance .Net Technology (170707)
</tr></table> </div> </form></body></html>
Default.aspx.vb
Imports System.Data.SqlClient
Public Class _Default Inherits System.Web.UI.Page
Protected Sub RegisterUser(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim userId As Integer = 0 Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("INSERT INTO [Users] (Username,Password,Email) VALUES(@Username, @Password , @Email )") Using sda As New SqlDataAdapter()
cmd.Parameters.AddWithValue("@Username", txtUsername.Text.Trim()) cmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim()) cmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim()) cmd.Connection = con con.Open() cmd.ExecuteNonQuery() con.Close() End Using End Using Dim message As String = String.Empty Select Case userId Case -1 message = "Username already exists.\nPlease choose a different username." Exit Select Case -2 message = "Supplied email address has already been used." Exit Select Case Else message = "Registration successful.\nUser Id: " + userId.ToString() Exit Select
VIMAT/BE/CE/120940107018
![Page 27: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/27.jpg)
Advance .Net Technology (170707)
End Select End Using End SubEnd Class
Output:
VIMAT/BE/CE/120940107018
![Page 28: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/28.jpg)
Advance .Net Technology (170707)
Practical:-16
Aim: Create Web application which Demonstrate Use Of Web services.
Program:
Imports System.Web.ServicesImports System.Web.Services.ProtocolsImports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.' <System.Web.Script.Services.ScriptService()> _<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<ToolboxItem(False)> _Public Class Service1 Inherits System.Web.Services.WebService
<WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function <WebMethod()> _ Public Function addition(ByVal a As Integer, ByVal b As Integer) As String Return a + b End Function <WebMethod()> _ Public Function subt(ByVal a As Integer, ByVal b As Integer) As String Return a - b End Function <WebMethod()> _ Public Function mul(ByVal a As Integer, ByVal b As Integer) As String Return a * b End Function <WebMethod()> _ Public Function div(ByVal a As Integer, ByVal b As Integer) As String Return a / b End FunctionEnd Class
VIMAT/BE/CE/120940107018
![Page 29: scvagadiya.files.wordpress.com … · Web viewCreate a Program to demonstrate the Use of Inheritance in VB.NET. Program: Module Module1](https://reader031.vdocuments.site/reader031/viewer/2022011917/5feb363b764ca07c2802804f/html5/thumbnails/29.jpg)
Advance .Net Technology (170707)
Output:
VIMAT/BE/CE/120940107018