0

I am using Linq2twitter library in Visual Basics to build a twitter app that will monitor my twitter feed and communicate with my Arduino (via COM) to perform a certain action whenever i tweet something!! I am new to Visual Basics and Application Programming Interface so i am trying to learn from the basics!! After hard work and research I created a simple GUI(having a button and a richtextbox) wrote some codes and i was able to tweet!! My 1st code was something like this

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim credentials As IOAuthCredentials = New InMemoryCredentials
    credentials.ConsumerKey = "xxxx"
    credentials.ConsumerSecret = "xxxx"
    credentials.OAuthToken = "xxxx"
    credentials.AccessToken = "xxxxx"
   Dim auth As PinAuthorizer = New PinAuthorizer()
    auth.Credentials = credentials
   Dim twitterCtx As TwitterContext = New TwitterContext(auth)
   twitterCtx.UpdateStatus(Box1.Text) 'Box1 is the richtextbox
End Sub

This code worked :)

Now i want a twitter homepage feed So after a long research i was able to write the following code

Dim auth As PinAuthorizer = New PinAuthorizer()
    auth.Credentials = credentials
    Dim twitterCtx As TwitterContext = New TwitterContext(auth)
    Dim tweets = From tweet In twitterCtx.Status
    Where tweet.Type = StatusType.Home

Now how do i make the "tweet" display on another textbox i made?? :S Will this code work?? There are very few examples of vb using Linq2twitter and having no idea of how this library is used made it a real pain in the butt to write these codes. And How am i doing?? Is this the write way?? How can i learn faster and better?? Please leave your suggestions!! And I found out twittervb.dll library was easier to use but it didn't work for me! I don't know why!! I got a flood of exception errors...and i have set my application settings to Read, Write and DirectMessages !! Thanks in advance :)

1 Answers1

0

There is a LinqToTwitterDemoVB project in the downloadable source code with VB samples. My VB samples are growing, but I have a lot of pending requests for samples for multiple technologies and scenarios and it will take a while to reach all the samples I want to include. My Documentation is mostly in C#, but once you see how a couple C# queries translate into VB, you will be able to figure out the rest of the commands and queries.

LINQ to Twitter is a 3rd party library that lets you use LINQ to communicate with Twitter. You use it to either Tweet, as in the UpdateStatus you have working, or to query Twitter. When you query Twitter, you'll get a response that depends on the type of query. That response is data that you can use in your application. Once you have the data, LINQ to Twitter has performed its work and you are responsible for writing the code that uses that data.

The query above, for the Home Timeline, looks fine. Now you have tweets, which is a collection of Status. First, you'll need to learn how to display a collection of objects with VB for the technology you're working with. Once you've figured that out, you'll know how to display the collection of Status that LINQ to Twitter gives you.

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60
  • Thank you very much...That helped a lot...You are the author?? :O It must be hard to manage such a vast project. I appreciate your great work sir!! :) Thanks again!! :) – user2626326 Jul 28 '13 at 06:10
  • Yeah, I created it. There are an increasing number of VB devs using it, so I'll need to do more VB samples moving forward. Good luck with your project. – Joe Mayo Jul 28 '13 at 16:47