Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Source Codes For Beginners Pt.1
#1
These are just some sources i had found on my computer. (credit to their owners)


Start Process

Code:
Process.Start("www.TechnicForums.com")


External Ip

Code:
Public Class iMe

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Husam As New System.Net.WebClient
        Dim ip As String
        ip = System.Text.Encoding.ASCII.GetString(( _
        Husam.DownloadData("Http://whatismyip.com/automation/n09230945.asp")))
        TextBox1.Text = ip

    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Me.Close()
    End Sub
End Class


Fade in (Form Effect)

Code:
Delegate Sub FadeIn_Delegate(ByRef [Form] As Form, ByRef [TimeMs] As Double, ByRef [ToOpacity] As Double)

    Public Sub FadeIn(ByRef whd As Form, ByRef ms As Double, ByRef ToOpacity As Double)
        Dim etime As DateTime
        If whd.InvokeRequired Then
            Dim d As New FadeIn_Delegate(AddressOf FadeIn)
            whd.Invoke(d, New Object() {whd, ms, ToOpacity})
        Else
            Try
                While whd.Opacity < ToOpacity
                    whd.Opacity += 0.01
                    If whd.Opacity = ToOpacity Then Exit While
                    etime = Now.AddMilliseconds(ms)
                    While Now < etime
                        System.Windows.Forms.Application.DoEvents()
                    End While
                End While
            Catch ex As Exception
                Exit Try
            End Try
        End If
    End Sub


Type Writer (Text Effect)

Code:
Public Class Form1
    Dim i As Integer = 0
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 300 'Typing Speed.
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim strtext As String = TextBox1.Text
        Dim textarray() As Char = strtext.ToCharArray()

        If i = Len(strtext) Then
            Timer1.Stop()
            Me.Close()
        Else
            RichTextBox1.AppendText(textarray(i))
            i = i + 1
        End If

    End Sub

End Class



Progress Bar

Code:
ProgressBar1.Increment(textbox1.text)
If ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Stop()
MsgBox("Progress Bar Loaded 100%")
ProgressBar1.Increment(-100)
Timer1.Interval = (TextBox2.Text)
End If

Rc4 Text Encryption

Code:
Public Shared Function rc4(ByVal message As String, ByVal password As String) As String

        Dim i As Integer = 0
        Dim j As Integer = 0
        Dim cipher As New StringBuilder
        Dim returnCipher As String = String.Empty

        Dim sbox As Integer() = New Integer(256) {}
        Dim key As Integer() = New Integer(256) {}

        Dim intLength As Integer = password.Length

        Dim a As Integer = 0
        While a <= 255

            Dim ctmp As Char = (password.Substring((a Mod intLength), 1).ToCharArray()(0))

            key(a) = Microsoft.VisualBasic.Strings.Asc(ctmp)
            sbox(a) = a
            System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
        End While

        Dim x As Integer = 0

        Dim b As Integer = 0
        While b <= 255
            x = (x + sbox(b) + key(b)) Mod 256
            Dim tempSwap As Integer = sbox(b)
            sbox(b) = sbox(x)
            sbox(x) = tempSwap
            System.Math.Max(System.Threading.Interlocked.Increment(b), b - 1)
        End While

        a = 1

        While a <= message.Length

            Dim itmp As Integer = 0

            i = (i + 1) Mod 256
            j = (j + sbox(i)) Mod 256
            itmp = sbox(i)
            sbox(i) = sbox(j)
            sbox(j) = itmp

            Dim k As Integer = sbox((sbox(i) + sbox(j)) Mod 256)

            Dim ctmp As Char = message.Substring(a - 1, 1).ToCharArray()(0)

            itmp = Asc(ctmp)

            Dim cipherby As Integer = itmp Xor k

            cipher.Append(Chr(cipherby))
            System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
        End While

        returnCipher = cipher.ToString
        cipher.Length = 0

        Return returnCipher

    End Function

I would Like +Rep for sharing this but i am not allowed to ask..Hehe
[Image: OGForumsbanner.png]
Reply


Messages In This Thread
Source Codes For Beginners Pt.1 - by SouR'D - 02-21-2010, 09:46 PM
RE: Source Codes For Beginners Pt.1 - by Danny - 02-23-2010, 08:33 PM
RE: Source Codes For Beginners Pt.1 - by Ezzat - 03-01-2010, 08:59 AM
RE: Source Codes For Beginners Pt.1 - by Matt™ - 03-01-2010, 09:25 AM
RE: Source Codes For Beginners Pt.1 - by Sam - 11-13-2010, 12:24 PM
RE: Source Codes For Beginners Pt.1 - by KoBE - 11-13-2010, 02:11 PM
RE: Source Codes For Beginners Pt.1 - by versx - 12-01-2010, 09:43 PM
RE: Source Codes For Beginners Pt.1 - by Chimi - 12-06-2010, 01:40 AM
RE: Source Codes For Beginners Pt.1 - by Packers - 12-12-2010, 04:59 PM
RE: Source Codes For Beginners Pt.1 - by Katz - 12-12-2010, 05:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Source Codes For Beginners Pt.2 SouR'D 9 3,542 11-25-2012, 10:35 PM
Last Post: ƃu∀ ıʞƃu∀
  [Source ] Hemp Tycoon App [/Source] VB.net KoBE 8 9,758 03-05-2012, 10:30 PM
Last Post: SomeWhiteGuy?
  [Source]Sql Database Project [Source] Digital-Punk 0 1,440 10-16-2011, 07:01 AM
Last Post: Digital-Punk
  [Source]Batch to Exe converter[Source] Digital-Punk 6 2,983 10-15-2011, 03:00 AM
Last Post: Digital-Punk
  [Source]File Assembly changer Vb.Net[Source] Digital-Punk 0 3,105 10-13-2011, 06:35 PM
Last Post: Digital-Punk

Forum Jump:


Users browsing this thread: 4 Guest(s)