That’s right guys and gals, you can very easily and quickly post to your twitter account using Visual Basic.net. The function below is a fully functional VB.net 2008 Twitter Posting function.
Simply call the function below as follows:
PostonTwitter(“username”,”password”,”what i want to post”)
Public Sub PostonTwitter(ByVal userName As String, ByVal password As String, ByVal updateMessage As String)
Dim wc As Net.WebClient = New Net.WebClient()
wc.Credentials = New Net.NetworkCredential(userName, password)
Net.ServicePointManager.Expect100Continue = False
Dim updateMessageBytes As Byte() = System.Text.Encoding.UTF8.GetBytes(“status=” + updateMessage)
‘Use UTF8 to get it properly encoded if you use characters like ç ã etc…
wc.UploadData(“http://twitter.com/statuses/update.xml”, updateMessageBytes)
End Sub
Hi. I like the way you write. Will you post some more articles?
Is it possible to set where it is sent from?
I’ve written a VB.NET library for communicating with the Twitter API. It’s 100% free, and 100% VB.Net.
http://code.google.com/p/twittervb
Thanks for the comment Duane, This function I posted is extremely simple. I see your library carries with it additional functionality.
Great piece of code, was really helpful…
Can you also do something similar for posting to Blogger using VB.NET?
Thanks Daniel, I’ve just used your code and converted to a CLR stored proc so I can easily post stuff off my SQL user group website out to our twitter account UKSQLUserGroup.
Keep up the good work Daniel and thanks! Just need facebook now 🙂
Can you post a similar code snippet to delete tweets from an account? Thanks…
hi.
so an have any solution for blogger?
I am try search from internet ….
not any.
thank.
Getting an error
The remote server returned an error: (401) Forbidden
On this line wc.UploadData(“http://twitter.com/statuses/update.xml”, updateMessageBytes)
Using VB2010
NoSecret
I have the same error
Did anyone get a resolution to:
The remote server returned an error: (401) Forbidden
On this line wc.UploadData(“http://twitter.com/statuses/update.xml”, updateMessageBytes)
not working,plz post updated code
I wrote this some time back… it’s entirely possible the code has changed since then. I know i was using the older method which i believe they were going to be turning off. I’ll see what i can find now and post any updates i find.
I believe this may be related to the outdated posting method. I’ll look to see if i can find any updates and test/post the results.
Can you also do something similar for posting to Blogger using VB.NET? (anonymously)
Do you have the updated code snippet for posting tweets/status on FB using VB 2010?