This Blog is composed of how to create a program in Visual Studio.

How to Create a Money Denomination

How to create money denominator



1st Step: Create Design.


Ø  Drag a 1 label onto the form and change the label TEXT in properties.
o   Change the TEXT into “Input Value :”

Ø   Drag a 2 textbox onto the form and change the textbox NAME in properties.
o   For 1st  textbox change the NAME  into “txtInputValue”
o   For 2nd  textbox change the NAME  into “txtResult”

Ø  Drag a 1 Button onto the form and change the Button NAME and TEXT in properties.
o   For Button name change the NAME into “btnDenominate”.
o   For Button text change the TEXT into “Denominate”.

2nd Step: Start Coding.

Ø  To Start Coding, double click the Form.
o   Code for the Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtResult.Text = " 1000 : " & n1000 & vbNewLine & "   500 :          " & n500 &            vbNewLine & "   200 : " & n200 &              vbNewLine & "   100 : " & n100 &                vbNewLine &          "     50 : " & n50 & vbNewLine & "     20 : " & n20 &                vbNewLine & "     10 : " & n10 & vbNewLine & "       5 : "          &   n5 &                vbNewLine & "       1 : " & n1 
End Sub

Ø  Go back to design, then double click the Denominate Button
o   Code for the Denominate Button

Private Sub btnDenominate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDenominate.Click

        n1000 = txtInputValue.Text \ 1000
        n500 = (txtInputValue.Text Mod 1000) \ 500
        n200 = ((txtInputValue.Text Mod 1000) Mod 500) \ 200
        n100 = (((txtInputValue.Text Mod 1000) Mod 500) Mod 200) \                 100
        n50 = ((((txtInputValue.Text Mod 1000) Mod 500) Mod 200)                   Mod 100) \ 50
        n20 = (((((txtInputValue.Text Mod 1000) Mod 500) Mod 200)                   Mod 100) Mod 50) \ 20
        n10 = ((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200)                 Mod 100) Mod 50) Mod 20) \ 10
        n5 = (((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200)                 Mod 100) Mod 50) Mod 20) Mod 10) \ 5
        n1 = ((((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200)                 Mod 100) Mod 50) Mod 20) Mod 10) Mod 5) \ 1

        txtResult.Text = " 1000 : " & n1000 & vbNewLine & "   500 :               " & n500 & vbNewLine & "   200 : " & n200 & vbNewLine               &"   100 : " & n100 & vbNewLine & "     50 : " & n50 &               vbNewLine & "     20 : " & n20 & vbNewLine & "     10               : " & n10 & vbNewLine & "       5 : " & n5                           & vbNewLine & "1 : " & n1

End Sub


3rd Step: Run the Program.

Ø  Click to start Debugging Button (F5).





Code:
Public Class Form1
    Dim n1000, n500, n200, n100, n50, n20, n10, n5, n1 As String

    Private Sub btnDenominate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDenominate.Click

        n1000 = txtInputValue.Text \ 1000
        n500 = (txtInputValue.Text Mod 1000) \ 500
        n200 = ((txtInputValue.Text Mod 1000) Mod 500) \ 200
        n100 = (((txtInputValue.Text Mod 1000) Mod 500) Mod 200) \ 100
        n50 = ((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) \ 50
        n20 = (((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) \ 20
        n10 = ((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) \ 10
        n5 = (((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) Mod 10) \ 5
        n1 = ((((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) Mod 10) Mod 5) \ 1

        txtResult.Text = " 1000 : " & n1000 & vbNewLine & "   500 : " & n500 & vbNewLine & "   200 : " & n200 & vbNewLine & "   100 : " & n100 & vbNewLine & "     50 : " & n50 & vbNewLine & "     20 : " & n20 & vbNewLine & "     10 : " & n10 & vbNewLine & "       5 : " & n5 & vbNewLine & "       1 : " & n1

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtResult.Text = " 1000 : " & n1000 & vbNewLine & "   500 : " & n500 & vbNewLine & "   200 : " & n200 & vbNewLine & "   100 : " & n100 & vbNewLine & "     50 : " & n50 & vbNewLine & "     20 : " & n20 & vbNewLine & "     10 : " & n10 & vbNewLine & "       5 : " & n5 & vbNewLine & "       1 : " & n1
    End Sub
End Class









Share:

How to Add Crystal Report

How to Add Crystal Report

1st Step:  Go to Project


2nd Step:  Click Add New Item



3rd Step:  Click Reporting


4th Step:  Click Crystal Report


5th Step:  Click Add


6th Step:  Click As a Blank Report



7th Step:  Click Ok


8th Step:  Create Design

               




                   Ø right Click to add tools

                              o   Ex. Adding text object











Share:

How to Create a Simple Log-In that have Database

How to create a simple Log-In that have Database



1st Step: Create Design.
                                           

Ø  Drag a label, textbox and button onto the form and change the label TEXT and NAME in properties.
o   For Number:
§  1. => change the label text into “User Name:”
§  2. => change the label text into “Password”
§  3. => change the textbox name into “txtUserName”
§  4. => change the textbox name into “Password”
§  5. => change the button text into “LogIn” and button name into “btnLogIn”


2nd Step: Create Database.
Ø      Steps on how to create a database
o   Open any Microsoft Office Access
o   Click Blank Database
o   Change file Name into DBAcount(any DB file name)
o   Click Create
o   Right Click Table1
o   Click Design View
o   Create table name(ex: tblAcount)
o   Click Ok
o   Create a Primary Key(ex: User_ID) with the Data type (ex: “AutoNumber”)
o   Create attribute (ex: UserName and Password) with the Data type (ex: Text)
o   Input Value for the UserName and Password
o   Close tblAcount
3rd Step: Create Module for the Database Connection
Ø  Steps on how to Create a Module
o   Go to Project
o   Click Add Module
o   Change Name(ex: ModConnection)
o   Click Add
o   Start Coding
§  Import sytem data Oledb
·         Imports System.Data.OleDb
§  Inside the ModConnection
§  Create a Public Variable Name for the New OledbCommand(ex: mycommand)
·         Public mycommand As New OleDbCommand
§  Create a Public Variable Name for the OleDbDataReader(ex: mysqleader)
·         Public mysqlreader As OleDbDataReader
§  Create a Public Variable Name for the OleDbDataAdapter(ex: myAdapter)
·         Public myadapter As New OleDbDataAdapter
§  Create a Public Variable Name for the New DataSet(ex: myDataSet)
·         Public mydataset As New DataSet
§  Create a Public Variable Name for the New DataTable(ex: myDataTable)
·         Public mydataTable As New DataTable
§  Create a Public Variable Name “sqlState”
·         Public sqlState As String
§  Create a Public Variable Name for the OlebDb.OlebdbConnection(ex: conn)
·             Public conn As OleDb.OleDbConnection = getConnection()
§  Create a Public Function name for OleDb.OleDbConnection (ex: getConnection)
·         Public Function getConnection() As OleDb.OleDbConnection
·         Inside the Public Function get your database name
o   Ex. Return New OleDb.OleDbConnection("Provider=Microsoft.Ace.OLEDB.12.0; Data Source=" & Application.StartupPath & "\DATABASE" & "\DBAcount.accdb")

4th Step: Start Coding for the Log-In Form

    Public Class LogIn
    Dim pass, user As String

    Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
        VerifyAcount()
    End Sub

    Private Sub VerifyAcount()

        Try
            sqlState = "SELECT UserName,Password from tblAcount where UserName='" & txtUserName.Text & "'and Password='" & txtPassword.Text & "'"
            conn.Open()
            mycommand = conn.CreateCommand
            mycommand.CommandText = sqlState
            myadapter.SelectCommand = mycommand
            myadapter.Fill(mydataset, "tblAcount")
            mydataTable = mydataset.Tables("tblAcount")
            mysqlreader = mycommand.ExecuteReader
            While mysqlreader.Read
                pass = mysqlreader("Password")
                user = mysqlreader("UserName")
            End While


            If pass = txtPassword.Text And user = txtUserName.Text Then
                MsgBox("Log-In Succesdully!")

            Else
                MsgBox("Invalid Password And UserName")
            End If

        Catch ex As Exception
            MsgBox("" & ex.Message)
        End Try
        conn.Close()
    End Sub

 
End Class


5th Step: Run the Program

                             Ø  Click to start Debugging Button (F5).
                
                            







Share:

About Me

My photo
Pagadian City, IX, Philippines

Followers

Social Profiles

Follow us

Keyboard

USB Drive

Total Pageviews