VK LABELS

Thursday, 26 January 2017

Note Pad++ Free Editor Download:

  • Note Pad++ is a free Source code editor
  • It is very useful to edit the source codes.
  • It supports several Languages to Create and Edit Source Codes.
            Download NotePad++



Sunday, 22 January 2017

Open Files through VB.NET Windows Application

Open Files through VB.NET Windows Application:
  • Use the below code for Open the files through VB.NET Windows Application.
Process.Start("explorer.exe", "C:\Details.xlsx")

Sunday, 16 March 2014

Create a Tool Tip for Windows Application using VB.Net

Create Tool Tip using VB.NET:
  • You Can Use the below code to create Tool Tip for Windows Application.
Dim toolTip1 As New ToolTip()
        toolTip1.SetToolTip(Button6, "Add Details")


Create a Web Page for show current date and Time using VB.Net

Create a Web Page for show the Current Date and Time:
  • Design Web Page Using Text Box, Label Box, and Button.
  • Use Script manager, and Timer.
  • Use the below code to show current date and time in vb.net web application.

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = Format(DateTime.Now, "dd/MM/yyyy")
        TextBox2.Text = Format(Now, "Long Time")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Timer1.Enabled = True
        Timer1.Interval = 1000
    End Sub

    Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label5.Text = Format(DateTime.Now, "dd/MM/yyyy")
        Label4.Text = Format(Now, "Long Time")
    End Sub
End Class

Program for Student Information DataBase and Perform the Add, Delete, and Update

PROGRAM FOR STUDENT INFORMATION DATABASE AND PERFORM THE FOLLOWING OPERATIONS: ADDITION, DELETION, AND UPDATION:

USING ORACLE DATABASE:
FORM1:

Imports System.Data
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class Form1

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Form2.Show()
    End Sub
   
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("PLEASE TYPE NAME")
        ElseIf TextBox2.Text = "" Then
            MsgBox("PLEASE TYPE DATE OF BIRTH")
        ElseIf TextBox3.Text = "" Then
            MsgBox("PLEASE TYPE ROLL NO")
        ElseIf TextBox4.Text = "" Then
            MsgBox("PLEASE TYPE REGNO")
        ElseIf TextBox5.Text = "" Then
            MsgBox("PLEASE TYPE CLASS")
        ElseIf TextBox6.Text = "" Then
            MsgBox("PLEASE TYPE PERCENTAGE")
        Else
            Dim oradb As String = "Data Source=XE;User Id=HR;Password=password;"
            Dim conn As New OracleConnection(oradb)
            conn.Open()
            Dim cmd As New OracleCommand
            cmd.Connection = conn
            cmd.CommandText = "insert into SDB values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "')"
            cmd.CommandType = CommandType.Text
            cmd.ExecuteNonQuery()
            MsgBox("Record is successfully stored")
            conn.Dispose()
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form3.Show()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form4.Show()
    End Sub
   
    End Class

FORM 3:

Imports System.Data
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class Form3

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("PLEASE TYPE REGISTER NUMBER")
        Else
            Dim oradb As String = "Data Source=XE;User Id=HR;Password=password;"
            Dim conn As New OracleConnection(oradb)
            conn.Open()
            Dim cmd As New OracleCommand
            Dim cmd1 As New OracleCommand
            cmd.Connection = conn
            cmd.CommandText = "SELECT * FROM SDB WHERE REGNO='" & TextBox1.Text & "'"
            cmd.CommandType = CommandType.Text
            Dim dr As OracleDataReader
            dr = cmd.ExecuteReader()
            If dr.Read() Then
                TextBox1.Text = dr("REGNO")
                cmd1.Connection = conn
                cmd1.CommandText = "delete from SDB WHERE REGNO='" & TextBox1.Text & "'"
                cmd1.CommandType = CommandType.Text
                cmd1.ExecuteNonQuery()
                MsgBox("Record is successfully deleted")
                conn.Dispose()
            Else
                MsgBox("REGISTER NUMBER IS NOT AVOILABLE")
            End If
        End If
    End Sub

    End Class

FORM 4:

Imports System.Data
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class Form4

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("PLEASE TYPE REGISTER NUMBER")
        Else
            Panel1.Visible = True
        End If
    End Sub

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Panel1.Visible = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox2.Text = "" Then
            MsgBox("PLEASE TYPE NAME")
        ElseIf TextBox3.Text = "" Then
            MsgBox("PLEASE TYPE DOB")
        ElseIf TextBox4.Text = "" Then
            MsgBox("PLEASE TYPE ROLL NO")
        ElseIf TextBox5.Text = "" Then
            MsgBox("PLEASE TYPE REG NO")
        ElseIf TextBox6.Text = "" Then
            MsgBox("PLEASE TYPE CLASS")
        ElseIf TextBox7.Text = "" Then
            MsgBox("PLEASE TYPE PERCENTAGE")
        Else
            Dim oradb As String = "Data Source=XE;User Id=HR;Password=password;"
            Dim conn As New OracleConnection(oradb)
            conn.Open()
            Dim cmd As New OracleCommand
            cmd.Connection = conn
            cmd.CommandText = "UPDATE SDB SET NAME='" & TextBox2.Text & "',DOB='" & TextBox3.Text & "',ROLLNO='" & TextBox4.Text & "',REGNO='" & TextBox5.Text & "',CLASS='" & TextBox6.Text & "',PERCENTAGE='" & TextBox7.Text & "' WHERE REGNO='" & TextBox1.Text & "'"
            cmd.CommandType = CommandType.Text
            cmd.ExecuteNonQuery()
            MsgBox("Record is Successfully Edited")
            conn.Dispose()
        End If
    End Sub
End Class

USING MS SQL DATABASE:

FORM 1:

Imports System.Data
Imports System.Data.SqlClient
Public Class Form1

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Form2.Show()
    End Sub
           
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("PLEASE TYPE NAME")
        ElseIf TextBox2.Text = "" Then
            MsgBox("PLEASE TYPE DATE OF BIRTH")
        ElseIf TextBox3.Text = "" Then
            MsgBox("PLEASE TYPE ROLL NO")
        ElseIf TextBox4.Text = "" Then
            MsgBox("PLEASE TYPE REGNO")
        ElseIf TextBox5.Text = "" Then
            MsgBox("PLEASE TYPE CLASS")
        ElseIf TextBox6.Text = "" Then
            MsgBox("PLEASE TYPE PERCENTAGE")
        Else
            Dim sqldb As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
            Dim con As New SqlConnection(sqldb)
            con.Open()
            Dim cmd As New SqlCommand
            cmd.Connection = con
            cmd.CommandText = "insert into Table1 values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "')"
            cmd.CommandType = CommandType.Text
            cmd.ExecuteNonQuery()
            MsgBox("Record is successfully stored")
            con.Dispose()
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form3.Show()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form4.Show()
    End Sub

End Class

FORM 3:

Imports System.Data
Imports System.Data.SqlClient
Public Class Form3

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("PLEASE TYPE REGISTER NUMBER")
        Else
            Dim sqldb As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
            Dim conn As New SqlConnection(sqldb)
            conn.Open()
            Dim cmd1 As New SqlCommand
            cmd1.Connection = conn
            cmd1.CommandText = "delete from Table1 WHERE REGNO='" & TextBox1.Text & "'"
            cmd1.CommandType = CommandType.Text
            cmd1.ExecuteNonQuery()
            MsgBox("Record is successfully deleted")
            conn.Dispose()
        End If
    End Sub

    End Class

FORM 4:
Imports System.Data
Imports System.Data.SqlClient
Public Class Form4

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("PLEASE TYPE REGISTER NUMBER")
        Else
            Panel1.Visible = True
        End If
    End Sub

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Panel1.Visible = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox2.Text = "" Then
            MsgBox("PLEASE TYPE NAME")
        ElseIf TextBox3.Text = "" Then
            MsgBox("PLEASE TYPE DOB")
        ElseIf TextBox4.Text = "" Then
            MsgBox("PLEASE TYPE ROLL NO")
        ElseIf TextBox5.Text = "" Then
            MsgBox("PLEASE TYPE REG NO")
        ElseIf TextBox6.Text = "" Then
            MsgBox("PLEASE TYPE CLASS")
        ElseIf TextBox7.Text = "" Then
            MsgBox("PLEASE TYPE PERCENTAGE")
        Else
            Dim sqldb As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
            Dim conn As New SqlConnection(sqldb)
            conn.Open()
            Dim cmd As New SqlCommand
            cmd.Connection = conn
            cmd.CommandText = "UPDATE Table1 SET NAME='" & TextBox2.Text & "',DOB='" & TextBox3.Text & "',ROLLNO='" & TextBox4.Text & "',REGNO='" & TextBox5.Text & "',CLASS='" & TextBox6.Text & "',PERCENTAGE='" & TextBox7.Text & "' WHERE REGNO='" & TextBox1.Text & "'"
            cmd.CommandType = CommandType.Text
            cmd.ExecuteNonQuery()
            MsgBox("Record is Successfully Edited")
            conn.Dispose()
        End If
    End Sub


    End Class