07-27-2011, 01:46 AM
I think that I followed all steps but I getting this error: {"Exception of type 'TwitterAPIException' was thrown."}
Can you check the code?
Imports TwitterVB2
Public Class twitter
Public tw As New TwitterAPI
Dim consumer As String = "QQT9vjRAYODUr8VNDM6A5w"
Dim consumersecret As String = "4fM7Tkw24HpWlCxh3hJPyjNbu1jtKuUWtvUSJyf94g"
Public oauthtoken As String
Public oauthtokensecret As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim url As String = tw.GetAuthorizationLink(consumer, consumersecret)
Process.Start(url)
Catch ex As Exception
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MsgBox("You must insert a code!")
Else
'Proceed
Dim isValid As Boolean = tw.ValidatePIN(TextBox1.Text)
If isValid = True Then
oauthtoken = tw.OAuth_Token
oauthtokensecret = tw.OAuth_TokenSecret
tw.AuthenticateWith(consumer, consumersecret, oauthtoken, oauthtokensecret)
Label2.Text = tw.AccountInformation.Name
Else
MsgBox("Wrong code!")
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
tw.AuthenticateWith(consumer, consumersecret, oauthtoken, oauthtokensecret)
tw.Update(TextBox2.Text)
End Sub
End Class
Can you check the code?
Imports TwitterVB2
Public Class twitter
Public tw As New TwitterAPI
Dim consumer As String = "QQT9vjRAYODUr8VNDM6A5w"
Dim consumersecret As String = "4fM7Tkw24HpWlCxh3hJPyjNbu1jtKuUWtvUSJyf94g"
Public oauthtoken As String
Public oauthtokensecret As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim url As String = tw.GetAuthorizationLink(consumer, consumersecret)
Process.Start(url)
Catch ex As Exception
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MsgBox("You must insert a code!")
Else
'Proceed
Dim isValid As Boolean = tw.ValidatePIN(TextBox1.Text)
If isValid = True Then
oauthtoken = tw.OAuth_Token
oauthtokensecret = tw.OAuth_TokenSecret
tw.AuthenticateWith(consumer, consumersecret, oauthtoken, oauthtokensecret)
Label2.Text = tw.AccountInformation.Name
Else
MsgBox("Wrong code!")
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
tw.AuthenticateWith(consumer, consumersecret, oauthtoken, oauthtokensecret)
tw.Update(TextBox2.Text)
End Sub
End Class