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
#2
Very nice job here Smile +REP Big Grin

Edit: Oops! I need 100 posts to give reps Sad
Reply
#3
thx for sharing that.....
Reply
#4
Thanks I liked the encryption one. Big Grin
Reply
#5
Why did you ask then?
Reply
#6
SouRD Wrote:I would Like +Rep for sharing this but i am not allowed to ask..

You want +Rep for sharing someone else's work? Nono Its a good post, and you did good by not taking credit. But, you can do a quick google search and come up with this.

Again, good post. But +Rep will come.. when it's deserved.
Reply
#7
Hey thanks for these bro. Just what I have been looking for Smile. Some simple code to get me started.
Reply
#8
It's very useful for beginners but the "Fade in (Form Effect)" it's very cool, you should definitely use it if you want it to make it more attractive.
That's really weird,Ninja
Reply
#9
It's very usefull...I'm also trying to make this work Big Grin thank's man!
[Image: logo.png]
xSexy.org | The New Sexy Forum ! [Erotic Pics & Videos]
Reply
#10
Quite useful indeed, thanks for posting this.
[Image: Navineous.gif]
Reply


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)