Monday, October 27, 2014

Visual Basic (VB) is lost in the crowd.

These days 95%, if not 99, of software/web, mobile development job vacancies requires you, a job seeker (ENTRY LEVEL), to know @ least 3 of the below listed packages. Two from software/web development and one from database management.

Software/Web Development Lang(s)
C/C++ 
C#
Asp.net
Java
Php
Python
Ruby
HTML, CSS & JavaScript

Database Management
Ms SQL
My SQL
Oracle

I am just curious as to what is happening to the once popular Visual Basic a.k.a (vb)…. Is it lost in the crowd? Is it outdated? like i said, just curious:::

Thursday, October 23, 2014

An Application Package on Library Management System (LMS) ~~ VisualBasic Code Snippet + GUI Design

Librarian & Member Login

                                                      
                                              Member Management

Source Code Snippet

Wednesday, August 20, 2014

An Application Package on, 3DES, Data Encryption & Decryption ~~ VisualBasic Code Snippet + GUI Design

                                  File Menu { --New  --Open  --Save  --Exit  

                                                                        
 Operation Menu--Encrypt file/Data --Decrypt file/Data


Encrypting Data/File (plain text) Using Encryption Key (9090)
** You 're to use your own key **


            Encrypted Data/File


Decrypting Data/File (cipher text) Using  Key (9090)


Decrypted Data/File


                           Format Menu { --Font  --Fore-Color --BackGround-Color
             

**SOURCE CODE "Snippet" ** 


Imports System.Security.Cryptography

Public Class Index   ' Class Begins

    Sub Encryption()

   Dim plainText As String = txtPlain_Cipher_Text.Text    'InputBox("Enter the plain text:")
   Dim EncryptionKey As String = InputBox("Enter Encryption Key")

        Dim container As New Main(EncryptionKey)
        Dim cipherText As String = container.EncryptData(plainText) 
        txtPlain_Cipher_Text.Text = cipherText 
    End Sub
'==================================================
    Sub Decryption()

        If txtPlain_Cipher_Text.Text = String.Empty Then

            Try

                OpenFileDialog.ShowDialog()
                txtPlain_Cipher_Text.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog.FileName)

            Catch Ooops As IO.FileNotFoundException
                'Do nothing
            End Try

        Else

            Dim DecryptionKey As String = InputBox("Enter Decryption Key:")
            Dim container As New Main(DecryptionKey)

            Try
                Dim plainText As String = container.DecryptData(txtPlain_Cipher_Text.Text)
                txtPlain_Cipher_Text.Text = plainText

            Catch ex As System.Security.Cryptography.CryptographicException
                MsgBox("Invalid Key.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly)
            End Try

        End If
    End Sub
 '==================================================
    Private Sub EncryptToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EncryptToolStripMenuItem.Click

        Encryption()

    End Sub
 '==================================================
    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click

        txtPlain_Cipher_Text.Text = String.Empty

    End Sub
 '==================================================
    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click

        If txtPlain_Cipher_Text.Text = String.Empty Then
            MsgBox("No text found", MsgBoxStyle.Information + MsgBoxStyle.OkOnly)
        Else
            SaveFileDialog.ShowDialog()
            Dim path As String = SaveFileDialog.FileName
            Try
                System.IO.File.WriteAllText(path, txtPlain_Cipher_Text.Text)
            Catch ae As ArgumentException
                MsgBox("File not saved; No file name selected", MsgBoxStyle.Information + MsgBoxStyle.OkOnly)
            End Try
        End If
    End Sub
 '==================================================
    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click

        Try
            OpenFileDialog.ShowDialog()
            txtPlain_Cipher_Text.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog.FileName)
        Catch ex As IO.FileNotFoundException ' Exception caught when closing the Dialog box without making any selection
            'do nothing
        End Try
    End Sub
 '==================================================
    Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
        FontDialog.ShowDialog()

        txtPlain_Cipher_Text.Font = FontDialog.Font

    End Sub
 '==================================================
    Private Sub ForeColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ForeColorToolStripMenuItem.Click

        ColorDialog.ShowDialog()
        txtPlain_Cipher_Text.ForeColor = ColorDialog.Color

    End Sub
 '==================================================
    Private Sub BackGroundColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackGroundColorToolStripMenuItem.Click

        ColorDialog.ShowDialog()
        txtPlain_Cipher_Text.BackColor = ColorDialog.Color

    End Sub
 '==================================================
   
    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click

        Me.Close()

    End Sub
 '==================================================
    Private Sub DecryptToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DecryptToolStripMenuItem.Click

        Decryption()

    End Sub 

End Class  ' Class Ends Here
 '==================================================
   

Wednesday, July 30, 2014

My first html/javascript code on "functions"

  My first html/javascript code on functions. 

 @ first I thought javascript would be java and nothing more. But, today, I can say YES it is and NO it’s not. Yes because, if you understand java then you ‘re almost done with javascript. No because, you still got some catching up to do. See the below code. In java, you dare not call a no argument(s) method with argument(s).
 More so, everything (variables, data types, etc…) you use is either implicitly defined which you‘ve to import to your code ""except java.lang class"" OR explicitly defined by you.
 Well, I believe every language has it own style. You just have to understand every single logic.
---------------------------------------------------------
Line 8 declared a function add with no argument. Line 17 calls the add functions with arguments… Even though i clearly understands how it works, it still looks awful to me compare to java.
 What the below code actually does is – create a function call add(), line 8. Declare a variable named value which is initialized to 0, line 9. Create a for loop that add/sum the passed in parameters, line 11 – 13. Return the sum value, line 14. Line 17 shows the passes in values/parameters (2,4,6,8,10) while line 18 displays the value (sum).
---------------------------------------------------------

1. <!DOCTYPE html>
2. <html>
3. <head>
4. <title> JavaScript Functions </title>
5.
6.   <script type="text/javascript">
7. 
8.    function add() {
9.     var value = 0
10.       
11.        for(i=0; i < arguments.length; i++) {
12.        value+=arguments[i];
13.        }
14.     return value;
15.    }
16.   
17.    var mainValue = add(2,4,6,8,10);
18.    alert(mainValue);  
19.
20.   </script>
21.
22.
23. </head>
24. <body>
25. <h1> JavaScript Functions  </h1>
26. </body>
27. </html>
-----------------------------------------------------------
RESULT = 30
-----------------------------------------------------------

--------------------------------------------
LITERAL FUNCTION – create a function without a name then assign it to a named variable Ooops. @ the end of the function declaration, include the function parameters (line 10)
--------------------------------------------

1. <!DOCTYPE html>
2. <html>
3. <head>
4. <title> JavaScript Function </title>
5.
6.   <script type="text/javascript">
7.  
8.   var Ooops = (function(){
9.     return arguments[1] + arguments[2];
10.   })(1,2,3);
11.
12.    alert(Ooops);
13.
14.   </script>
15.
16. </head>
17. <body>
18. <h1> JavaScript Function </h1>
19. </body>
20. </html>
-----------------------------------------------------------
RESULT = 5
-----------------------------------------------------------

--------------------------------------------
ANONYMOUS FUNCTION – create a function without a name. @ the end of the function declaration, include the function parameters (line 10)
--------------------------------------------

1. <!DOCTYPE html>
2. <html>
3. <head>
4. <title> JavaScript Anonymous Function </title>
5.
6.   <script type="text/javascript">
7.  
8.   alert((function(){
9.     return arguments[0] + arguments[1];
10.   })(4,5,3));
11.
12.   </script>
13.
14. </head>
15. <body>
16. <h1> JavaScript Anonymous Function </h1>
17. </body>
18. </html>
-----------------------------------------------------------
RESULT = 9
-----------------------------------------------------------
KNOW THIS – if you ‘re already familiar with java & new to javascript THEN your new friend will be SYNTAX ERROR(S)

Thursday, July 24, 2014

An Application Package on Automated Teller Machine (ATM) ~~ VisualBasic Code Snippet + GUI Design



 CODE SNIPPET

Public Class atm
    Public Sub countpin()
        If txtpin.TextLength > 3 Then
            errpro.SetError(txtpin, "Invalid Entry!!! Maximum Entry Reached")
            txtpin.Text = txtpin.Text & "" 
        End If
    End Sub

    Public Sub btnclick()
        If btninsertcard.Text = "Card Inserted" Then
            entervalue()
        Else
        End If
        disablebuttons() ' disabling the buttons
    End Sub

    ' declaring a method for entering values e.g pin e.t.c
    Sub entervalue()
        If txtpin.Text = String.Empty Then
            txtpin.Text = Me.ActiveControl.Text
        Else
            txtpin.Text = txtpin.Text & Me.ActiveControl.Text
        End If
        If txtpin.Text.Length = 5 Then
            MessageBox.Show("Maximum Entry Exceeded""SkyeBank", MessageBoxButtons.OK, MessageBoxIcon.Information)
            txtpin.Text = String.Empty
        End If
    End Sub

    Public Sub disablebuttons()
        If txtpin.Text.Length = 4 Then
        Else
            enablebuttons()
        End If
    End Sub

    Public Sub enablebuttons()
        groupboxbtn.Enabled = True
    End Sub

    Private Sub TimerPendulum_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerPendulum.Tick
        txtwelcome.Left = txtwelcome.Left - 1
        If txtwelcome.Left = 69 Then
            TimerPendulum.Enabled = False
            TimerPendulum1.Enabled = True
        End If
    End Sub

    Private Sub TimerPendulum1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerPendulum1.Tick
        txtwelcome.Left = txtwelcome.Left + 1
        If txtwelcome.Left = 177 Then
            TimerPendulum1.Enabled = False
            TimerPendulum.Enabled = True
        End If
    End Sub

    Private Sub atm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtmainscreen.Visible = False
        Me.ActiveControl = btnminus
        txtboxstmt.Visible = False

        'Panelmain.Visible = False
        lblcount.Visible = False
        txtpin.Visible = False
        txtpin.BackColor = txtboard.BackColor
  End Sub

    Private Sub TimerChangeColor_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerChangeColor.Tick
        lblcount.Text = lblcount.Text + 1
        If lblcount.Text = 4 Then
            txtChangeColor.BackColor = Color.LightGreen
        ElseIf lblcount.Text = 10 Then
            txtChangeColor.BackColor = Color.White
            TimerChangeColor.Enabled = False
            lblcount.Text = 0
            TimerChangeColor.Enabled = True
        End If
    End Sub

    Private Sub btnzero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzero.Click
        btnclick()
        ' countpin()
    End Sub

    Private Sub btninsertcard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btninsertcard.Click
        enablebuttons()
        ' making the textpin visibility to be true...
        TimerChangeColor.Enabled = False
        txtChangeColor.BackColor = Color.LightGreen
        txtwelcome.Visible = False
        txtpin.Visible = True
        txtpin.Text = String.Empty
        txtboxstmt.Visible = True    'making the enter pin stmt visible...
        If btninsertcard.Text = "Insert Card" Then
            btninsertcard.Text = "Card Inserted"
            btninsertcard.Enabled = False
        End If
        txtpin.Focus()
    End Sub

    Private Sub btnone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnone.Click
        btnclick()
    End Sub

    Private Sub btntwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntwo.Click
        btnclick()
    End Sub

    Private Sub btnthree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthree.Click
        btnclick()
    End Sub

    Private Sub btnfour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfour.Click
        btnclick()
    End Sub

    Private Sub btnfive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfive.Click
        btnclick()
    End Sub

    Private Sub btnsix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsix.Click
        btnclick()
    End Sub

    Private Sub btnseven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseven.Click
        btnclick()
    End Sub

    Private Sub btneight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneight.Click
        btnclick()
    End Sub

    Private Sub btnnine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnine.Click
        btnclick()
    End Sub

    Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancel.Click
        txtwelcome.Visible = True
        txtboxstmt.Visible = False
        txtpin.Text = String.Empty
        txtpin.Visible = False
        btninsertcard.Text = "Insert Card"
        btninsertcard.Enabled = True
        TimerChangeColor.Enabled = True
    End Sub 
  
End Class
________________________________________________________
....Just Snippet; need the full atm design? feel free to reach me