Saturday, 21 December 2013



Salam semua .. arini gue mau share cara-caranya gimana mahu membuat auto update status di Facebook menggunakan vb.net 2008/2010/2020 pon bole dong ..

Jika anda menggunakan kod ini .. berilah saya kredit kerana sumber kod ini dan tutorial diolah 100% oleh saya .
Pertama sekali kamu orang haruslah memiliki peralatan seperti dibawah :

1. Visual Basic(Jika lu orang tidak memilikinya bole download dibawah ajaaa dong)


2. Otak/akal
3. Daya Usaha
4. Tawakal

Ok.. semuanya sudah ada ?? ayuh kite mulakan tutornya ..

1. 5 timer di form1
2. Satu webbrowser di form1
3. tiga button di form1
4. tiga label di form1
5. satu textbox di form1 dan hidekan textbox tersebut(kecilkan textbox tersebut)

Berikan nama pada button1 -> Connect with Facebook
dan letakkan kod dibawah ini pada button1(double klik)

Kod :WebBrowser1.Navigate("http://m.facebook.com")

Berikan nama pada button2 -> STOP
dan letakkan kod dibawah ini pada button2(double klik)

kod :  Label1.Text = "00" : Label2.Text = "00" : Label3.Text = "00"
        Timer1.Enabled = False
        Timer2.Enabled = False
        Timer3.Enabled = False
        Timer4.Enabled = False
        Timer5.Enabled = False
        TextBox1.Clear()
     Dim HomePage As String = "Http://m.facebook.com/"
        Dim wc As New WebClient
        Dim programversion As String
        Try
            programversion = wc.DownloadString(HomePage)
        Catch ex As Exception
            MessageBox.Show("Check your connection", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
        wc.Dispose()

Kemudian pastekan kod dibawah di form1.vb :

kod : Private Sub Uptodated1()
        Try
            Static Dim PostStatus As Integer
            TextBox1.Visible = True
            TextBox1.Text = Form2.TextBox1.Text
            PostStatus += 1
            WebBrowser1.Document.GetElementById("publish").InvokeMember("click")
            RefreshConection()
        Catch ex As Exception
            MessageBox.Show("Check your connection", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            MessageBox.Show("An error occured during updating the status. Please try again !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
    End Sub
    Private Sub Uptodated2()
        Try
            Static Dim PostStatus As Integer
            TextBox1.Visible = True
            TextBox1.Text = Form2.TextBox2.Text
            PostStatus += 1
            WebBrowser1.Document.GetElementById("publish").InvokeMember("click")
            RefreshConection()
        Catch ex As Exception
            MessageBox.Show("Check your connection", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            MessageBox.Show("An error occured during updating the status. Please try again !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
    End Sub
    Private Sub Uptodated3()
        Try
            Static Dim PostStatus As Integer
            TextBox1.Visible = True
            TextBox1.Text = Form2.TextBox3.Text
            PostStatus += 1
            WebBrowser1.Document.GetElementById("publish").InvokeMember("click")
            RefreshConection()
        Catch ex As Exception
            MessageBox.Show("Check your connection", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            MessageBox.Show("An error occured during updating the status. Please try again !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
    End Sub
    Private Sub Uptodated4()
        Try
            Static Dim PostStatus As Integer
            TextBox1.Visible = True
            TextBox1.Text = Form2.TextBox4.Text
            PostStatus += 1
            WebBrowser1.Document.GetElementById("publish").InvokeMember("click")
            RefreshConection()
        Catch ex As Exception
            MessageBox.Show("Check your connection", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            MessageBox.Show("An error occured during updating the status. Please try again !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
 Private Sub Uptodated5()
        Try
            Static Dim PostStatus As Integer
            TextBox1.Visible = True
            TextBox1.Text = Form2.TextBox5.Text
            PostStatus += 1
            WebBrowser1.Document.GetElementById("publish").InvokeMember("click")
            RefreshConection()
        Catch ex As Exception
            MessageBox.Show("Check your connection", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            MessageBox.Show("An error occured during updating the status. Please try again !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try

Kemudian masukkan kod dibawah ini disetiap timer mengikut urutan seperti timer1,timer2,timer3,timer4,timer5 :

kod :  Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Try
            Label3.Text = Val(Label3.Text) + Val(1)
            If Label3.Text = "20" Then
                Label2.Text = Val(Label2.Text) + Val(1)
                Label3.Text = "0"
            ElseIf Label2.Text = "60" Then
                Label1.Text = Val(Label1.Text) + Val(1)
                Label1.Text = "0"
            End If

            If Label2.Text = "15" Then
                TextBox1.Clear()
            End If

            If Label1.Text = Form2.ComboBox1.Text Then
                Timer2.Start()
                Uptodated1()
                Label2.Text = "00"
                Label3.Text = "00"
                Label4.Text = "00"
                Timer1.Stop()
            End If
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Try
            Label3.Text = Val(Label3.Text) + Val(1)
            If Label3.Text = "20" Then
                Label2.Text = Val(Label2.Text) + Val(1)
                Label3.Text = "0"
            ElseIf Label2.Text = "60" Then
                Label1.Text = Val(Label1.Text) + Val(1)
                Label2.Text = "0"
            End If

            If Label2.Text = "15" Then
                TextBox1.Clear()
            End If

            If Label1.Text = Form2.ComboBox1.Text Then
                Timer3.Start()
                Uptodated2()
                Label2.Text = "00"
                Label3.Text = "00"
                Label4.Text = "00"
                Timer2.Stop()
            End If
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        Try
            Label3.Text = Val(Label3.Text) + Val(1)
            If Label3.Text = "20" Then
                Label2.Text = Val(Label2.Text) + Val(1)
                Label3.Text = "0"
            ElseIf Label2.Text = "60" Then
                Label1.Text = Val(Label1.Text) + Val(1)
                Label2.Text = "0"
            End If

            If Label2.Text = "15" Then
                TextBox1.Clear()
            End If

            If Label1.Text = Form2.ComboBox1.Text Then
                Timer4.Start()
                Uptodated3()
                Label2.Text = "00"
                Label3.Text = "00"
                Label4.Text = "00"
                Timer3.Stop()
            End If
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
        Try
            Label3.Text = Val(Label3.Text) + Val(1)
            If Label3.Text = "20" Then
                Label2.Text = Val(Label2.Text) + Val(1)
                Label3.Text = "0"
            ElseIf Label2.Text = "60" Then
                Label1.Text = Val(Label1.Text) + Val(1)
                Label2.Text = "0"
            End If

            If Label2.Text = "15" Then
                TextBox1.Clear()
            End If

            If Label1.Text = Form2.ComboBox1.Text Then
                Timer4.Start()
                Uptodated4()
                Label2.Text = "00"
                Label3.Text = "00"
                Label4.Text = "00"
                Timer3.Stop()
            End If
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
        Try
            Label3.Text = Val(Label3.Text) + Val(1)
            If Label3.Text = "20" Then
                Label2.Text = Val(Label2.Text) + Val(1)
                Label3.Text = "0"
            ElseIf Label2.Text = "60" Then
                Label1.Text = Val(Label1.Text) + Val(1)
                Label2.Text = "0"
            End If

            If Label2.Text = "15" Then
                TextBox1.Clear()
            End If

            If Label1.Text = Form2.ComboBox1.Text Then
                Timer1.Start()
                Uptodated5()
                Label1.Text = "00"
                Label2.Text = "00"
                Label3.Text = "00"
                Timer5.Stop()
            End If
        Catch ex As Exception
        End Try

Sekarang create new windows form dan namakanya form2.vb dan letakkan bahan2 seperti dibawah pada form2 :

1. 6 label dan namakan 5 label menjadi 1,2,3,4,5 dan lagi satu label terkakhir minute(s)
2. satu combobox
3. satu button dan namakan button tersebut menjadi OK
5. lima textbox(label tadi letakkan bersebelahan textbox)

Double klik pada form2 dan letakkan kod dibawah :

kod :  ComboBox1.Text = "10"

Double klik pada button dan letakkan kod dibawah pula :

 If Len(TextBox1.Text) = 0 Or Len(TextBox2.Text) = 0 Or Len(TextBox3.Text) = 0 Or Len(TextBox4.Text) = 0 Or Len(TextBox5.Text) = 0 Then
            MsgBox("You have to complete all the blank form !", Microsoft.VisualBasic.MsgBoxStyle.Critical, Me.Text)
        Else
            Form1.Visible = True
            Me.Visible = False
            Me.Hide()
            Form1.Timer1.Enabled = True
        End If

Siap .. kod ini seratus peratus diolah oleh saya dong dan pertolong google :D

Credit : NoEntry , PhantomCrews

0 comments:

Post a Comment