How To Make A Simple Stopwatch In Javascript

this is the look of the stopwatch

the script add it below head
this is the form code

thanks for reading

Javascript Popup Message Box

this is something very simple and it seems like this


just add this somewhere else in you html

How To Add Favicon To Your HTML Page


adding a favicon to your html page is easy with the newest web designer software(S) but now i will teach you the way to add a favicon to your html page

How To Make A Redirection In HTML

you may know that on some website has redirections like when you go to the website theres a image and a text"Click the logo if not redirected" i thought to make it a tutorial so lets get started,

this is the code:

How To Store Data Under APPDATA Using VB.NET

for some reason we need to store datas under %APPDATA% for people who dont know what is APPDATA, APPDATA is a system folder which is used to store cookies,program settings,templates,etc . You can use APPDATA to store your application datas safely  .

to access the folder you can use this one line code

How To Check If Both Textboxes Are Blank In VB.NET

i had a problem so i found a way to solve it i wanted to share it with you all so if you have two textboxes and if you want to check if both are blank use this code

How To Make A Image Slider With PHP/HTML And Jquary

this is something very cool by the way we gonna make it with some simple jquery ok now follow the steps

first open your php editor and make a new php file now add the css style and save it as SlideShow.php




How To Switch Off Your LCD Monitor With VB.NET

this is something very cool , this will switch off your monitor i tested this on LCD so just you can add a button and double click the form and erase everything and add this and try it out

How to Create a Custom Button Control in VB.NET

Reusable classes and controls are a very important part of any object-oriented programming language. More so is the ability to create your own controls or customize existing ones. In this tutorial, we'll learn how to create a custom button using the pre-existing Button class.

Firstly, as for any VB.NET project, launch Microsoft Visual Basic or Microsoft Visual Studio. From the start menu, select "New Project", then "Class Library" from the dialog. Name your project and confirm.

How to Create a Custom Button Control in VB.NET

How To Make A Tabbed WebBrowser In VB.NET

this is going to be very good , i will teach you to make a advanced web browser in vb.net . just create a new project


drag and drop 7 buttons from the toolbox and change the text property as below
button1-back
button2-forward
button3-refresh
button4-stop
button5-go
button6-add tab
button7-close tab

add a textbox


now add a tabcontrol from toolbox and delete all the tabpages(tabpage1>tabpage2))

like this


add a webbrowser and set the webbrowser behind the form

now add this codes i mean just erase everything and add this

How To Make Web Browser Using GeckoFX In VB.NET

gecko is firefox  . we're going to make a fastest web browser using gecko firefox , i will tech you the basics only ok lets get started

first of all download this archive - download

finish downloading and extract the archive in c drive just extract it dont do anything and now create a new project and when form loaded right click in toolbox and select choose items


Window State In VB.NET

there are three window states , they are Minimize,Maximize,Normal so we can do them with code easily you can add 3 button and you can change the text properties to Minimize,Maximize,Normal and add the codes to them

How To Clean Recycle Bin Using VB.NET

this is simple snippet , i am using a function to do this work ok now add this functions and a sub included

How To Get Local IP In C#

this is a simple code to get the local ip on c# first add imports system.net; namespace and add this sub

//Author : Mohamed Shimran
//Blog : http://www.ultimateprogrammingtutorials.blogspot.com

   public string GetIp()
        {
            System.Net.IPAddress[] IP = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
            for (int n = 0; n < IP.Length; n++)
            {
                return IP[n].ToString();
            }

        }
now you can add this code to a click event or any other events to get the ip address

How To Save Text Using RichTextBox!

Ok, in this post. I'll teach you how to save your text using richtextbox.

Ok, first get a SaveFileDialog

Make the Filter of the SaveFileDialog to Text File |*.txt

Ok, next get a RichTextBox and a Button

Double Click the Button and type the codes below

What Is SendKeys In VB.NET And How To Use It

just thought to write something what will make alot sense so i am gonna explain what is sendkeys() and how to use it
you can use SendKeys() to type words like they are typed from your keyboard

for instance :

add this code to a button click event or any other click events

process.start("notepad")

Sendkeys.Send("Testing 123 123 123)")

what this actually do is , when you click on the button notepad.exe(windows notepad) will open and automatically Testing 123 123 123 will be typed in the notepad

some people use sendkeys() to make bots

for instance :
you have a game and for example lets take mario and you need to press spacebar to jump so you can use this on a timer and it will do it automatically

sendkeys.sendwait("^{ }")

by the way sendkeys() are super fast than we type

you can also use sendkeys() to automatically type in a messenger or a chat box (skype,yahoo messenger,oovoo,msn,etc)

for instance :

add a textbox and add a button and add this code to click event , you should add this namespace imports system.windows.forms

Randomize()
Dim rand As Random
 Dim sendkey As String = "(" + rand.Next(1, 999).ToString + ")" + TextBox1.Text
 SendKeys.Send(sendkey)

How To Get The Windows Product Key In VB.NET

Let's get our windows product key from vb.net

Add the function below in your codes

How To Get HWID In VB.NET

Make a new project, right click on your project from solution explorer and select add reference then a window will come up now select System Management from .NET in the window.
After adding the reference go to the code and add this namespace : imports system.management now you just need to add the code that you can see below in any event, try the form load first.

Adobe Flash Player Updater Progressbar For VB.NET

this is something very cool by the way i am using images , if you know adobe flash player updater else here is a picture of the adobe flash updater progressbar

adobe flash player updater

ok lets get started just create a new project and download this files and add them to the resources and now add a picturebox and rename to pbback select picture box 1 backgroundimage from properties and select pb4 image from resources and now add a timer and set the interval to 100 and make the timer enabled = true you can change the timer interval for your needs if you want and now add a button two buttons from the toolbox , button one is to start the progressbar and button two is to reset the progressbar , add two pictureboxes and change the size to 2, 31 and rename one to pbright and the other one to pbleft now place the pbright on the right side of the picturebox1 and place the pbleft on the left side of the picturebox1

pbright and pbleft

now fix pbleft and pbright with pbback

How To Connect And Disconnect The Internet Using VB.NET

this is something simple , i have two ways . one is using cmd and the other one is using shell commands but the both are one line code

How To Make A Simple Captcha Control In ASP.NET

this is my first tutorial on asp.net by the way i am a beginner , i dont think this is something advanced but hope this is useful . i am gonna teach you how to make a simple captcha control without using any HTTP HANDLERS and you can easily add it to your website . all you need is a aspx page so create one ,, the aspx page will have image/jpg . i am using system.drawing namespace to create dynamic images , system will be generating two random numbers and it will store the results of the two numbers into a session variable .

for instance :

a = 2 + 6 (2 and 6 are two random numbers)

session("Answer") = 8

code for captcha.aspx

How To Make Your Programs Run Automatically When Windows Starts In VB.NET

This is something very useful this is will work on all windows versions because we are using registry and registry is the only way add programs to startup so lets get started making it. You need a button to add your application to startup and you need another button to remove your application from startup, you can also use checkbox instead buttons but i recommend buttons because that is the control that mostly suit for the work so when you add to buttons edit there property TEXT as given below

button1 - Add
button2 - Remove

Double click your button1 and add this code . dont forget to replace application name with your application name and one more thing dont forget to add the same application name to button 2 click event

How To Make A Web Scraper In VB.NET

You have a Web Browser on your application and a listbox and a button(i didn't mention about webbrowser controls) so when you're on a website or a lets say a web page you can click on the button and the all links of the website will be listed on the listbox

create a new project and add a listbox and a button and a webbrowser (add webbrowser controls)

now double click your button and add this code

    'Author : Mohamed Shimran
    'Blog : http://www.ultimateprogrammingtutorials.blogspot.com

Dim links As HtmlElementCollection = WebBrowser1.Document.Links
        For Each link As HtmlElement In links
            ListBox1.Items.Add(link.GetAttribute("href"))
        Next

now just debug

How To Add Watermark Text To Image In VB.NET

adding watermark text to image using vb.net , for sure i will say AWESOME , by the way i am not going to write a big tutorial with a lot functions i will just teach the basics then you can develop it as much as i know . you can add custom watermark text placer,font color,font,font size,save,etc so lets make it , open your visual basic 2008/2010 and make a new project and name it whatever you want and add two buttons and a textbox and a picturebox , click picturebox1 and properties > backgroundimagelayout > stretch . make your form look like what i have made up

How To Get Installed Fonts In VB.NET

this is not something as i wrote before by the way its kinds of that , i am just using a listbox and a label in this tutorials , the listbox will show all the fonts installed on your computer and the label will show how many fonts you have installed , lets make it , create a new project and name it whatever you want and add a listbox from the toolbox and a label and make everything fits the form like mine
get installed fonts

How To Get Installed Applications In VB.NET

you can even make this application like something which is used to uninstall applications by the way i just made this simple because you all should understand the basics of this so hope you understand what this actually is , lets make this . just open visual basic 2008/2010 and create a new project and select windows applications(windows forms application) after form loaded go to form properties and edit things what you do usually , now go to toolbox and drag and drop a listview tool into the form and go to listview properties and select columns and a small windows will popup , on the windows click add two times to add two columns
columnheader

VB.NET Drop Shadow At The Form Border

this is something make your application attractive by the way this is a simple code that you have to place under public class form1

vb.net drop shadow

so here is the code

Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
        Get
            Const DROPSHADOW = &H20000
            Dim cParam As CreateParams = MyBase.CreateParams
            cParam.ClassStyle = cParam.ClassStyle Or DROPSHADOW
            Return cParam
        End Get
    End Property

and the shadow

vb.net drop shadow preview

Changing Progress Bar Colors In VB.NET

this is a cool effect not a effect actually but like a effect so i made 3 colors for progressbar and actually they all looks awesome , they are red,green,yellow so lets get started

now if your on a project just add a progressbar or if your not on a project just create a new project and name it whatever you want and add a progressbar and double click your form and add these code below

Public Class Form1
    'ultimate programming tutorials
    Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Enum ProgressBarColor
        Green = &H1
        Red = &H2
        Yellow = &H3
    End Enum
    Private Shared Sub ChangeProgBarColor(ByVal ProgressBar_Name As Windows.Forms.ProgressBar, ByVal ProgressBar_Color As ProgressBarColor)
        SendMessage(ProgressBar_Name.Handle, &H410, ProgressBar_Color, 0)
    End Sub
End Class

now if you want to make your progressbar color green , add this code to a click event a button is better

Switch On/Off NumLock,CapsLock,ScrollLock In VB.NET

i hope this will be something more interesting and useful than others so this what actually do is , you can make two buttons on is for switching the NumLock,CapsLock and ScrollLock on and the other button is to switch of them all ok so create a new project and name them whatever you like to , add two buttons

now double click your form and erase everything and add this code

Public Class form1

    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)

    Private Const VK_CAPITAL As Integer = &H14
    Private Const VK_SCROLL As Integer = &H91
    Private Const VK_NUMLOCK As Integer = &H90

    Private Const KEYEVENTF_EXTENDEDKEY As Integer = &H1
    Private Const KEYEVENTF_KEYUP As Integer = &H2
end class

Change Opacity When Dragging The Form In VB.NET

this is something awesome , i hope you understand what this actually do . open your visual basic 2008/2010 and create a new project and double click your form and add this code

How To Drag And Drop Images Inside the Form In VB.NET

this is something very useful , i think you know what this actually do . the title says it . so lets get started making it just make a new project and name it whatever you want and double click your form and add this code

How To Validate Email Address In VB.NET

this is going to be interest , i am using regex here regex means regular expressions so lets get started , you just need to add a textbox and a button by the way if i say directly you need a button click event so this will work like this , you enter an email address and click on the button so if the email address you have entered is valid then a message box will popup and say that also if the email address you have entered incorrect then a message box will popup saying invalid email address

How To Move A Borderless Form In VB.NET

so you know you cant move a bored less form without a code so i got a code to move a bored less form

just add the code , code is explained

Newest Metro Controls For VB.NET

Metro Controls Is A Library For Your Windows Applications , You Can Get The Newest Metro Look On Your Applications Using This Library

Metro Controls

Metro Header button

Metro Header Button Is A Menu Button


Ubuntu Theme For VB.NET

Just add a class and add the codes and debug and use the theme and other controls from the toolbox

preview -


Awesome Custom Tab Control For VB.NET


This tab control is created by Dev Components .

the tab control looks like this.

Create a new class and add the codes and build your project then you will see the tab control in your toolbox.

Codes :
 Imports System.Drawing.Drawing2D  
 Class DotNetBarTabcontrol  
   Inherits TabControl  
   Sub New()  
     SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)  
     DoubleBuffered = True  
     SizeMode = TabSizeMode.Fixed  
     ItemSize = New Size(44, 136)  
   End Sub  
   Protected Overrides Sub CreateHandle()  
     MyBase.CreateHandle()  
     Alignment = TabAlignment.Left  
   End Sub  
   Function ToPen(ByVal color As Color) As Pen  
     Return New Pen(color)  
   End Function  
   Function ToBrush(ByVal color As Color) As Brush  
     Return New SolidBrush(color)  
   End Function  
   Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)  
     Dim B As New Bitmap(Width, Height)  
     Dim G As Graphics = Graphics.FromImage(B)  
     Try : SelectedTab.BackColor = Color.White : Catch : End Try  
     G.Clear(Color.White)  
     G.FillRectangle(New SolidBrush(Color.FromArgb(246, 248, 252)), New Rectangle(0, 0, ItemSize.Height + 4, Height))  
     'G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(Width - 1, 0), New Point(Width - 1, Height - 1))  'comment out to get rid of the borders  
     'G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(ItemSize.Height + 1, 0), New Point(Width - 1, 0))          'comment out to get rid of the borders  
     'G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(ItemSize.Height + 3, Height - 1), New Point(Width - 1, Height - 1)) 'comment out to get rid of the borders  
     G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(ItemSize.Height + 3, 0), New Point(ItemSize.Height + 3, 999))  
     For i = 0 To TabCount - 1  
       If i = SelectedIndex Then  
         Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))  
         Dim myBlend As New ColorBlend()  
         myBlend.Colors = {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240)}  
         myBlend.Positions = {0.0F, 0.5F, 1.0F}  
         Dim lgBrush As New LinearGradientBrush(x2, Color.Black, Color.Black, 90.0F)  
         lgBrush.InterpolationColors = myBlend  
         G.FillRectangle(lgBrush, x2)  
         G.DrawRectangle(New Pen(Color.FromArgb(170, 187, 204)), x2)  
         G.SmoothingMode = SmoothingMode.HighQuality  
         Dim p() As Point = {New Point(ItemSize.Height - 3, GetTabRect(i).Location.Y + 20), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 14), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 27)}  
         G.FillPolygon(Brushes.White, p)  
         G.DrawPolygon(New Pen(Color.FromArgb(170, 187, 204)), p)  
         If ImageList IsNot Nothing Then  
           Try  
             If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then  
               G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(x2.Location.X + 8, x2.Location.Y + 6))  
               G.DrawString("   " &amp; TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
             Else  
               G.DrawString(TabPages(i).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
             End If  
           Catch ex As Exception  
             G.DrawString(TabPages(i).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
           End Try  
         Else  
           G.DrawString(TabPages(i).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
         End If  
         G.DrawLine(New Pen(Color.FromArgb(200, 200, 250)), New Point(x2.Location.X - 1, x2.Location.Y - 1), New Point(x2.Location.X, x2.Location.Y))  
         G.DrawLine(New Pen(Color.FromArgb(200, 200, 250)), New Point(x2.Location.X - 1, x2.Bottom - 1), New Point(x2.Location.X, x2.Bottom))  
       Else  
         Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height + 1))  
         G.FillRectangle(New SolidBrush(Color.FromArgb(246, 248, 252)), x2)  
         G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(x2.Right, x2.Top), New Point(x2.Right, x2.Bottom))  
         If ImageList IsNot Nothing Then  
           Try  
             If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then  
               G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(x2.Location.X + 8, x2.Location.Y + 6))  
               G.DrawString("   " &amp; TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
             Else  
               G.DrawString(TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
             End If  
           Catch ex As Exception  
             G.DrawString(TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
           End Try  
         Else  
           G.DrawString(TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})  
         End If  
       End If  
     Next  
     e.Graphics.DrawImage(B.Clone, 0, 0)  
     G.Dispose() : B.Dispose()  
   End Sub  
 End Class  

If you're using earlier versions of vb.net you would get errors in these lines:

myBlend.Colors = {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232,
240), Color.FromArgb(232, 232, 240)}
myBlend.Positions = {0.0F, 0.5F, 1.0F}

an Anonymous commenter gave a solution for this, replace those two lines of code with these :
myBlend.Colors = New Color() {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240)}
myBlend.Positions = New Single() {0.0F, 0.5F, 1.0F}

Thank You

Work from anywhere on any device with a virtual cloud desktop by CloudDesktopOnline.com . For more hosted Microsoft applications such as Exchange, SharePoint, Dynamics CRM, Project Server and more, try Apps4Rent .

Awesome Metro Controls For VB.NET

I found a class that gives you some controls that are alike Metro controls :) , the controls that this theme has
Just add a new class and paste these codes below and debug your program and then check your toolbox for the awesome looking tools(metro tools)


'by mavamaarten
Public Class MetroSlideControl
    Inherits TabControl
    Dim OldIndex As Integer

    Private _Speed As Integer = 15
    Property Speed As Integer
        Get
            Return _Speed
        End Get
        Set(ByVal value As Integer)
            If value > 20 Or value < -20 Then
                MsgBox("Speed needs to be in between -20 and 20.")
            Else
                _Speed = value
            End If
        End Set
    End Property

    Sub New()
        SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw, True)
    End Sub

    Sub DrawPanel(ByVal Panel As Panel)
        Dim bitmap As New Bitmap(Panel.Width, Panel.Height)
        Panel.DrawToBitmap(bitmap, New Rectangle(0, 0, Panel.Width, Panel.Height))
        CreateGraphics.DrawImage(bitmap, New Point(0, 0))
    End Sub

    Sub DoAnimationScrollLeft(ByVal Control1 As Control, ByVal Control2 As Control)
        Dim G As Graphics = Control1.CreateGraphics()
        Dim P1 As New Bitmap(Control1.Width, Control1.Height)
        Dim P2 As New Bitmap(Control2.Width, Control2.Height)
        Control1.DrawToBitmap(P1, New Rectangle(0, 0, Control1.Width, Control1.Height))
        Control2.DrawToBitmap(P2, New Rectangle(0, 0, Control2.Width, Control2.Height))

        For Each c As Control In Control1.Controls
            c.Hide()
        Next

        Dim Slide As Integer = Control1.Width - (Control1.Width Mod _Speed)

        Dim a As Integer
        For a = 0 To Slide Step _Speed
            G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
            G.DrawImage(P2, New Rectangle(a - Control2.Width, 0, Control2.Width, Control2.Height))
        Next
        a = Control1.Width
        G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
        G.DrawImage(P2, New Rectangle(a - Control2.Width, 0, Control2.Width, Control2.Height))

        SelectedTab = Control2

        For Each c As Control In Control2.Controls
            c.Show()
        Next

        For Each c As Control In Control1.Controls
            c.Show()
        Next
    End Sub

    Protected Overrides Sub OnSelecting(ByVal e As System.Windows.Forms.TabControlCancelEventArgs)
        If OldIndex < e.TabPageIndex Then
            DoAnimationScrollRight(TabPages(OldIndex), TabPages(e.TabPageIndex))
        Else
            DoAnimationScrollLeft(TabPages(OldIndex), TabPages(e.TabPageIndex))
        End If
    End Sub

    Protected Overrides Sub OnDeselecting(ByVal e As System.Windows.Forms.TabControlCancelEventArgs)
        OldIndex = e.TabPageIndex
    End Sub

    Sub DoAnimationScrollRight(ByVal Control1 As Control, ByVal Control2 As Control)
        Dim G As Graphics = Control1.CreateGraphics()
        Dim P1 As New Bitmap(Control1.Width, Control1.Height)
        Dim P2 As New Bitmap(Control2.Width, Control2.Height)
        Control1.DrawToBitmap(P1, New Rectangle(0, 0, Control1.Width, Control1.Height))
        Control2.DrawToBitmap(P2, New Rectangle(0, 0, Control2.Width, Control2.Height))

        For Each c As Control In Control1.Controls
            c.Hide()
        Next

        Dim Slide As Integer = Control1.Width - (Control1.Width Mod _Speed)

        Dim a As Integer
        For a = 0 To -Slide Step -_Speed
            G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
            G.DrawImage(P2, New Rectangle(a + Control2.Width, 0, Control2.Width, Control2.Height))
        Next
        a = Control1.Width
        G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
        G.DrawImage(P2, New Rectangle(a + Control2.Width, 0, Control2.Width, Control2.Height))

        SelectedTab = Control2

        For Each c As Control In Control2.Controls
            c.Show()
        Next

        For Each c As Control In Control1.Controls
            c.Show()
        Next
    End Sub

    Public Sub NextPage()
        If SelectedIndex < TabPages.Count - 1 Then SelectedIndex += 1
    End Sub

    Public Sub PreviousPage()
        If SelectedIndex > 0 Then SelectedIndex -= 1
    End Sub

    Protected Overrides Sub WndProc(ByRef m As Message)
        If m.Msg = &H1328 Then
            m.Result = CType(1, IntPtr)
        Else
            MyBase.WndProc(m)
        End If
    End Sub

End Class

Public Class MetroPanel
    Inherits Panel

    Private _TitleText As String = "Title"
    Property Title As String
        Get
            Return _TitleText
        End Get
        Set(ByVal value As String)
            _TitleText = value
            Invalidate()
        End Set
    End Property

    Private _SubTitleText As String = "Subtitle"
    Property SubTitle As String
        Get
            Return _SubTitleText
        End Get
        Set(ByVal value As String)
            _SubTitleText = value
            Invalidate()
        End Set
    End Property

    Private _TitleFont As Font = New Font("Segoe UI Light", 16)
    Property TitleFont As Font
        Get
            Return _TitleFont
        End Get
        Set(ByVal value As Font)
            _TitleFont = value
        End Set
    End Property

    Private _SubTitleFont As Font = New Font("Segoe UI", 9)
    Property SubTitleFont As Font
        Get
            Return _SubTitleFont
        End Get
        Set(ByVal value As Font)
            _SubTitleFont = value
        End Set
    End Property

    Private _DrawBorders As Boolean
    Property DrawBorders As Boolean
        Get
            Return _DrawBorders
        End Get
        Set(ByVal value As Boolean)
            _DrawBorders = value
            Invalidate()
        End Set
    End Property

    Private _BorderColor As Color
    Property BorderColor As Color
        Get
            Return _BorderColor
        End Get
        Set(ByVal value As Color)
            _BorderColor = value
        End Set
    End Property

    Sub New()
        BackColor = Color.White
    End Sub

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim G As Graphics = e.Graphics
        G.Clear(BackColor)
        G.DrawString(_TitleText, _TitleFont, New SolidBrush(ForeColor), New Point(8, 5))
        G.DrawString(_SubTitleText, _SubTitleFont, New SolidBrush(ForeColor), New Rectangle(12, 35, Width - 25, Height - 50))
        If DrawBorders Then
            G.DrawRectangle(New Pen(_BorderColor), New Rectangle(0, 0, Width - 1, Height - 1))
        End If
        MyBase.OnPaint(e)
    End Sub

End Class

Public Class MetroButton
    Inherits Control
    Enum MouseState
        None = 0
        Over = 1
        Down = 2
    End Enum
    Private State As MouseState = MouseState.None

    Dim _BGOver As Color '= Color.FromArgb(75, 75, 75)
    Property BackColorOver As Color
        Get
            Return _BGOver
        End Get
        Set(ByVal value As Color)
            _BGOver = value
            Invalidate()
        End Set
    End Property

    Dim _BGDown As Color '= Color.FromArgb(55, 55, 55)
    Property BackColorDown As Color
        Get
            Return _BGDown
        End Get
        Set(ByVal value As Color)
            _BGDown = value
            Invalidate()
        End Set
    End Property

    Dim _BorderColor As Color
    Property BorderColor As Color
        Get
            Return _BorderColor
        End Get
        Set(ByVal value As Color)
            _BorderColor = value
            Invalidate()
        End Set
    End Property


    Dim BGC As Color
    Property BackColorNormal As Color
        Get
            Return BGC
        End Get
        Set(ByVal value As Color)
            BGC = value
        End Set
    End Property

    Sub New()
        ForeColor = Color.White
        Font = New Font("Segoe UI", 9)
        SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
        DoubleBuffered = True

        Dim R, G, B As Integer
        Dim BG As Color = BackColor

        R = BG.R - 20
        G = BG.G - 20
        B = BG.B - 20

        If R < 0 Then R = 0
        If G < 0 Then G = 0
        If B < 0 Then B = 0

        BGC = Color.FromArgb(R, G, B)

        Size = New Size(105, 27)
    End Sub

    Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
        Dim R, G, B As Integer

        R = BackColor.R - 20
        G = BackColor.G - 20
        B = BackColor.B - 20

        If R < 0 Then R = 0
        If G < 0 Then G = 0
        If B < 0 Then B = 0

        BGC = Color.FromArgb(R, G, B)

        R = BGC.R - 10
        G = BGC.G - 10
        B = BGC.B - 10

        If R < 0 Then R = 0
        If G < 0 Then G = 0
        If B < 0 Then B = 0

        _BGDown = Color.FromArgb(R, G, B)

        R = BGC.R + 10
        G = BGC.G + 10
        B = BGC.B + 10

        If R > 255 Then R = 255
        If G > 255 Then G = 255
        If B > 255 Then B = 255

        _BGOver = Color.FromArgb(R, G, B)

        R = BGC.R - 50
        G = BGC.G - 50
        B = BGC.B - 50

        If R < 0 Then R = 0
        If G < 0 Then G = 0
        If B < 0 Then B = 0

        _BorderColor = Color.FromArgb(R, G, B)
        MyBase.OnBackColorChanged(e)
    End Sub

    Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
        State = MouseState.Over
        Invalidate()
        MyBase.OnMouseEnter(e)
    End Sub

    Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
        State = MouseState.None
        Invalidate()
        MyBase.OnMouseLeave(e)
    End Sub

    Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
        State = MouseState.Down
        Invalidate()
        MyBase.OnMouseDown(e)
    End Sub

    Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
        State = MouseState.Over
        Invalidate()
        MyBase.OnMouseUp(e)
    End Sub

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim G As Graphics = e.Graphics
        Select Case State
            Case MouseState.None
                G.Clear(BGC)
            Case MouseState.Over
                G.Clear(BackColorOver)
            Case MouseState.Down
                G.Clear(BackColorDown)
        End Select
        G.DrawRectangle(New Pen(_BorderColor), New Rectangle(0, 0, Width - 1, Height - 1))
        Dim SF As New StringFormat : SF.Alignment = StringAlignment.Center : SF.LineAlignment = StringAlignment.Center
        G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(0, 0, Width - 1, Height - 1), SF)
        MyBase.OnPaint(e)
    End Sub

End Class

Public Class MetroTextBox
    Inherits Control

    Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
    Property TextAlign() As HorizontalAlignment
        Get
            Return _TextAlign
        End Get
        Set(ByVal value As HorizontalAlignment)
            _TextAlign = value
            If Base IsNot Nothing Then
                Base.TextAlign = value
            End If
        End Set
    End Property
    Private _MaxLength As Integer = 32767
    Property MaxLength() As Integer
        Get
            Return _MaxLength
        End Get
        Set(ByVal value As Integer)
            _MaxLength = value
            If Base IsNot Nothing Then
                Base.MaxLength = value
            End If
        End Set
    End Property
    Private _ReadOnly As Boolean
    Property [ReadOnly]() As Boolean
        Get
            Return _ReadOnly
        End Get
        Set(ByVal value As Boolean)
            _ReadOnly = value
            If Base IsNot Nothing Then
                Base.ReadOnly = value
            End If
        End Set
    End Property
    Private _UseSystemPasswordChar As Boolean
    Property UseSystemPasswordChar() As Boolean
        Get
            Return _UseSystemPasswordChar
        End Get
        Set(ByVal value As Boolean)
            _UseSystemPasswordChar = value
            If Base IsNot Nothing Then
                Base.UseSystemPasswordChar = value
            End If
        End Set
    End Property
    Private _Multiline As Boolean
    Property Multiline() As Boolean
        Get
            Return _Multiline
        End Get
        Set(ByVal value As Boolean)
            _Multiline = value
            If Base IsNot Nothing Then
                Base.Multiline = value

                If value Then
                    Base.Height = Height - 11
                Else
                End If
            End If
        End Set
    End Property
    Overrides Property Text As String
        Get
            Return MyBase.Text
        End Get
        Set(ByVal value As String)
            MyBase.Text = value
            If Base IsNot Nothing Then
                Base.Text = value
            End If
        End Set
    End Property
    Overrides Property Font As Font
        Get
            Return MyBase.Font
        End Get
        Set(ByVal value As Font)
            MyBase.Font = value
            If Base IsNot Nothing Then
                Base.Font = value
                Base.Location = New Point(3, 5)
                Base.Width = Width - 6
            End If
        End Set
    End Property

    Protected Overrides Sub OnParentChanged(ByVal e As System.EventArgs)
        If Not Controls.Contains(Base) Then
            Controls.Add(Base)
        End If
    End Sub

    Private Base As TextBox
    Dim C As Color
    Sub New()
        Font = New Font("Segoe UI", 9)
        Base = New TextBox
        Base.Font = Font
        Base.Text = Text
        Base.MaxLength = _MaxLength
        Base.Multiline = _Multiline
        Base.ReadOnly = _ReadOnly
        Base.UseSystemPasswordChar = _UseSystemPasswordChar
        Base.BorderStyle = BorderStyle.None
        Base.Location = New Point(5, 4)
        Base.Width = Width - 10

        If _Multiline Then
            Base.Height = Height - 11
        End If

        AddHandler Base.TextChanged, AddressOf OnBaseTextChanged
        AddHandler Base.KeyDown, AddressOf OnBaseKeyDown

        Dim R, G, B As Integer

        R = BackColor.R - 15
        G = BackColor.G - 15
        B = BackColor.B - 15

        If R < 0 Then R = 0
        If G < 0 Then G = 0
        If B < 0 Then B = 0

        C = Color.FromArgb(R, G, B)
        Base.BackColor = C
    End Sub

    Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
        MyBase.OnBackColorChanged(e)
        Dim R, G, B As Integer

        R = BackColor.R - 15
        G = BackColor.G - 15
        B = BackColor.B - 15

        If R < 0 Then R = 0
        If G < 0 Then G = 0
        If B < 0 Then B = 0

        C = Color.FromArgb(R, G, B)
        Base.BackColor = C
        Invalidate()
    End Sub

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim GG As Graphics = e.Graphics

        GG.Clear(C)
        GG.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
    End Sub
    Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
        Text = Base.Text
    End Sub
    Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
        If e.Control AndAlso e.KeyCode = Keys.A Then
            Base.SelectAll()
            e.SuppressKeyPress = True
        End If
    End Sub
    Protected Overrides Sub OnResize(ByVal e As EventArgs)
        Base.Location = New Point(5, 4)
        Base.Width = Width - 10

        If _Multiline Then
            Base.Height = Height - 11
        End If


        MyBase.OnResize(e)
    End Sub

End Class

Public Class MetroProgressbar
    Inherits Control

    Dim _BorderColor As Color = Color.Black
    Property BorderColor As Color
        Get
            Return _BorderColor
        End Get
        Set(ByVal value As Color)
            _BorderColor = value
            Invalidate()
        End Set
    End Property

    Dim _ProgressColor As Color = Color.FromArgb(10, 150, 40)
    Property ProgressColor As Color
        Get
            Return _ProgressColor
        End Get
        Set(ByVal value As Color)
            _ProgressColor = value
            Invalidate()
        End Set
    End Property

    Sub New()
        SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint, True)
        DoubleBuffered = True
    End Sub

    Dim _Val As Integer = 0
    Property Value As Integer
        Get
            Return _Val
        End Get
        Set(ByVal v As Integer)
            If v <= _Max Then _Val = v Else Throw New Exception("The entered value is not valid.")
            Invalidate()
        End Set
    End Property

    Dim _Max As Integer = 100
    Property Maximum As Integer
        Get
            Return _Max
        End Get
        Set(ByVal value As Integer)
            If value >= _Val Then _Max = value Else Throw New Exception("The entered value is not valid.")
        End Set
    End Property

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim G As Graphics = e.Graphics
        Dim Progress As Double = (_Val / _Max) * (Width - 2)
        G.Clear(BackColor)
        G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.Black)), New Rectangle(0, 0, Width - 1, Height - 1))
        If Progress > 0 Then G.FillRectangle(New SolidBrush(_ProgressColor), New Rectangle(1, 1, Progress, Height - 2))

        G.DrawRectangle(New Pen(_BorderColor), New Rectangle(0, 0, Width - 1, Height - 1))
        MyBase.OnPaint(e)
    End Sub
End Class
here is a picture of the controls in my form

How To Use Rails and Twitter Bootstrap to Start a Simple and Beautiful Blog

Ruby on Rails, often shortened to Rails, is an open source full-stack web application framework for the Ruby programming language.
Twitter Bootstrap is a free collection of tools for creating websites and web applications.
Today I will use Rails and Bootstrap to start a blog web application, just a few lines of command, you can create a simple and beautiful blog web, now let's start.
First, open the Terminal, we have to create a new rails application named blog.
    rails new blog
then we use scaffolding to create a post scafflod and connect to the database.
cd blog
rails generate scaffold Post title:string content:text
rake db:migrate
then we add the bootstrap to the application, open the Gemfile in the blog forder, and add the gem.
group :assets do
    gem 'twitter-bootstrap-rails'
end
then we run the command to install the gem.
bundle install
and it is time to use the bootstrap make the application look beautiful.
rails generate bootstrap:install static
rails g bootstrap:layout application fixed -f
rails g bootstrap:themed Posts -f
at last, you have to open the web server
    rails server
Now, just enjoy you blog application in your web browser through http://localhost:3000/posts

How To Make A Console Program Launcher

create a new project and select console application and name it whatever you want , this a simple tutorial to create a application launcher using console , this works like this : when user input the application name and press enter the application will launch if the application exist

i typed soundrecorder.exe and pressed enter so you can see sound recorder is been launched
if the application name is wrong then
lets make the program , create a new project and select console application and name it whatever you want, codes below


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

//Author : Mohamed Shimran
//Blog : http://www.ultimateprogrammingtutorials.blogspot.com

namespace Launch_Application

{
        class Program

        {
                static void Main()

                {
                        String txtApp;
                        Console.Write("Option: ");
                        txtApp = Console.ReadLine();
                        try
                        {
                               Process.Start(txtApp);
                                Console.WriteLine("Application: " + txtApp + ", Launched!!!!");
                        }
                        catch (Exception ex)
                        {
     Console.WriteLine(ex.Message);
                        }
                        Console.Read();
                }
        }

}

now debug , your done

How To Make A Simple Console Application In C#

this is a simple program to separate 6 digits from input, first you create string and name it (shim)  and you prompt the user to enter the number using console.write(); then you assign the user to input shim using the console.readline function so on you display each display/character using writeline , in this the argument comes after the comma in this argument

Console.WriteLine("First digit: {0}", shim.Substring(0,1));
shim.Substring(0,1) 

shim.substring(0,1) , when you use susbstring its going to read the string which is , the user input

console.readkey(); will keep the application awake

lets make the application , create a new project and select console application and name it whatever you want , add the codes below
using System;

namespace simple_console_application

{
        class Program

        {
                      static void Main(string[] args)

                {
                        string shim = "";

                        Console.Write("Enter a 6 digit Number: ");

                        shim = Console.ReadLine();

                        Console.WriteLine("First digit: {0}", shim.Substring(0,1));

                        Console.WriteLine("Second digit: {0}", shim.Substring(1, 1));

                        Console.WriteLine("Third digit: {0}", shim.Substring(2,1));

                        Console.WriteLine("Fourth digit: {0}", shim.Substring(3,1));

                        Console.WriteLine("Fifth digit: {0}", shim.Substring(4,1));

                        Console.WriteLine("Sixth digit: {0}", shim.Substring(5, 1));

                        Console.ReadKey();
                }

        }
}
now debug and see how it works , enjoy

How To Generate Random Numbers In C#

This is a simple tutorial
   
Random random = new Random();
int num = random.Next(1, 100000);
it generate numbers between 1 - 100000 , you can also change them . if you want to generate numbers between 1 - 500
you can use this
   
Random random = new Random();
int num = random.Next(1, 500);
just a simple change
make a new project and add a label and a button and use this code to generate random numbers
  
  private void button1_Click(object sender, EventArgs e)
        {
            Random random = new Random();
                        int num = random.Next(1, 100000);
                        label1.Text = Convert.ToString(num);
        }
   
you can even use a textbox instead label

Useful Snippets For C#

Opening another form

new Form2().Show();

Minimize Form 

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;

Maximize Form

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

Copy A File

File.Copy("C://program files/test.txt", dialog.FileName);

Delete A File

File.Delete("C://program files/test.txt");

Open A Website

System.Diagnostics.Process.Start("http://www.ultimateprogrammingtutorials.blogspot.com");

How To : Matrix on C# Console

hello all , after a long time i am back to write , so today i am gonna teach you to create a matrix screen on c# console , its pretty easy so lets begin making it , open your visual c# 2008/2010 and select console application and name it whatever you want now add this code


#define readkey
using System;

namespace m7tr1x
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "Matrix";
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WindowLeft = Console.WindowTop = 0;
            Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
            Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;
#if readkey
            Console.WriteLine("Press Any Key to Continue");
            Console.ReadKey();
#endif
            Console.CursorVisible = false;
            int width, height;
            int[] y;
            int[] l;
            Initialize(out width, out height, out y, out l);
            int ms;
            while (true)
            {
                DateTime t1 = DateTime.Now;
                MatrixStep(width, height, y, l);
                ms = 10 - (int)((TimeSpan)(DateTime.Now - t1)).TotalMilliseconds;
                if (ms > 0)
                    System.Threading.Thread.Sleep(ms);
                if (Console.KeyAvailable)
                    if (Console.ReadKey().Key == ConsoleKey.F5)
                        Initialize(out width, out height, out y, out l);
            }
        }

        static bool thistime = false;

        private static void MatrixStep(int width, int height, int[] y, int[] l)
        {
            int x;
            thistime = !thistime;
            for (x = 0; x < width; ++x)
            {
                if (x % 11 == 10)
                {
                    if (!thistime)
                        continue;
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.SetCursorPosition(x, inBoxY(y[x] - 2 - (l[x] / 40 * 2), height));
                    Console.Write(R);
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Console.SetCursorPosition(x, y[x]);
                Console.Write(R);
                y[x] = inBoxY(y[x] + 1, height);
                Console.SetCursorPosition(x, inBoxY(y[x] - l[x], height));
                Console.Write(' ');
            }
        }

        private static void Initialize(out int width, out int height, out int[] y, out int[] l)
        {
            int h1;
            int h2 = (h1 = (height = Console.WindowHeight) / 2) / 2;
            width = Console.WindowWidth - 1;
            y = new int[width];
            l = new int[width];
            int x;
            Console.Clear();
            for (x = 0; x < width; ++x)
            {
                y[x] = r.Next(height);
                l[x] = r.Next(h2 * ((x % 11 != 10) ? 2 : 1), h1 * ((x % 11 != 10) ? 2 : 1));
            }
        }

        static Random r = new Random();
        static char R
        {
            get
            {
                int t = r.Next(10);
                if (t <= 2)
                    return (char)('0' + r.Next(10));
                else if (t <= 4)
                    return (char)('a' + r.Next(27));
                else if (t <= 6)
                    return (char)('A' + r.Next(27));
                else
                    return (char)(r.Next(32, 255));
            }
        }

        public static int inBoxY(int n, int height)
        {
            n = n % height;
            if (n < 0)
                return n + height;
            else
                return n;
        }
    }
}


now run the application , enjoy