Tuesday, April 5, 2011

Twitter in Globe Travel System

Latest update in the Globe Travel system is mini widget in the main window let my user connect his twitter account to check the latest tweets and to quick send his tweets .. Enjoy it !!

Saturday, April 2, 2011

Twitter in Visual Basic.Net

Twitter is daily important tool for most of the internet users .
find here how you can use TwitterVB.dll in your vb.net Application .

1- Download the file TwitterVB-2.5
2- Add a reference .
3- Add the includes line to your project

Imports TwitterVB2

4- Now you have to take permission from your user to use his twitter account for so you have first to add your application in twitter means register your application from here http://twitter.com/oauth_clients
or try http://twittervb.codeplex.com/wikipage?title=XAuth&referringTitle=Documentation for more help

5- Once you finish the registration you will be presented by two requested strings ,the consumer key and the consumer secret .

6- Now you have the two strings which the user will use to give the permission to the system to access his twitter ,must be saved in the app settings ,text file or data base as you like .
use these two strings to get the link which will give the user the valid PIN code :
add this in general declaration area up be sure to use only one object for twitter lib

Dim Twitter As New TwitterVB2.TwitterAPI

then :

Url = Twitter.GetAuthorizationLink(ConsumerKey, ConsumerSecret)

7- you will get the PIN ,use it to got the other two strings which will be used for log in
Token and Token Secret

Dim Isvalid As Boolean = Twitter.ValidatePIN(TwPIN)
If Isvalid Then
Token = Twitter.OAuth_Token
TokenSecret = Twitter.OAuth_TokenSecret
End If

do the same and save these two strings which you will use every time your user will use the twitter .

every time to use the twitter you will need :
- Consumer key.
- Consumer secret .
- Token .
- Token Secret .

Now its the time to enjoy twitter in your App

Send Tweet :

Twitter.AuthenticateWith(ConsumerKey, ConsumerSecret, Token, TokenSecret)
Twitter.Update("Hello World")

Read the Tweets in your wall :

Public Function ReadMsgs(ByVal User As String) As String
Dim TwMsgs As String
Twitter.AuthenticateWith(ConsumerKey, ConsumerSecret, Token, TokenSecret)

For Each tweet As TwitterStatus In Twitter.HomeTimeline
TwMsgs = TwMsgs & tweet.User.ScreenName & " : " & tweet.Text
Next

Return TwMsgs
End Function

i hope you find this helpful