This code is throwing TwitterAPIException on this line
profilepic.ImageLocation = twitter.AccountInformation.ProfileImageUrl
I have a feeling it may be because it isn't authenticating but I'm not sure. any idea why i might be getting this, also how can i in my code check if twitter has authenticated me before trying to actually read data?
I have removed the private keys for privacy
Imports TwitterVB2
Public Class Form1
Dim twitter As New TwitterAPI
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 verify_btn.Click
twitter.AuthenticateWith("", "", "", "")
profilepic.BackColor = Color.White
profilepic.ImageLocation = twitter.AccountInformation.ProfileImageUrl
tw_name.Text = "HI" + twitter.AccountInformation.Name
For Each Tweet As TwitterStatus In twitter.HomeTimeline
tweets.AppendText(vbNewLine + vbNewLine + Tweet.User.ScreenName + vbNewLine + Tweet.Text + vbNewLine + Tweet.CreatedAtLocalTime + vbNewLine + vbNewLine + "..............................")
Next
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tw_name.Click
End Sub
Private Sub profilepic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles profilepic.Click
End Sub
End Class
I'm the developer of TwitterVB. :)
Because I stopped updating the library in 2011, TwitterVB was never updated to work with version 1.1 of the Twitter API. I've gotten many, many requests to address this specific issue, so I have made an updated version of the DLL available here:
https://github.com/DWRoelands/TwitterVB/releases/tag/3.1.1
Please note that I have done no testing and that this DLL should be considered "pre-release". If you have questions or issues, I'll do my best to answer them. You can reach me via my GitHub page:
https://github.com/DWRoelands
Related
How do I Get the Login Cookies when am logged into a site?
I am searching for answers and now turned to StackOverflow pro members for your expertise and help to get this out of the way so I can move on to making my software.
i need to get the cookies login/visit /get/post anything how do i get it using the new webview2 browser kindly shed some light please anyone
Option Explicit
'Note, that this Demo requires the properly registered RC6-Binaries
'and in addition an installed "Chromium-Edge" (in its "evergreen" WebView2-incarnation)
'installable from its official MS-Download-URL: https://go.microsoft.com/fwlink/p/?LinkId=2124703
Private WithEvents WV As cWebView2 'declare a WebView-variable WithEvents
Private Sub Form_Load()
Visible = True '<- it's important, that the hosting TopLevel-Form is visible...
'...(and thus the Child-PicBox indirectly as well) - before we Bind the PicBox to the WebView
Set WV = New_c.WebView2 'create the instance
If WV.BindTo(picWV.hWnd) = 0 Then MsgBox "couldn't initialize WebView-Binding": Exit Sub
' Set WV = New_c.WebView2(picWV.hWnd) 'create the instance
' If WV Is Nothing Then MsgBox "couldn't initialize WebView-Binding": Exit Sub
End Sub
'*** VB-Command-Button-Handlers
Private Sub cmdNavigate_Click()
WV.Navigate "https://google.com" '<- alternatively WV.jsProp("location.href") = "https://google.com" would also work
'the call below, just to show that our initially added js-functions, remain "in place" - even when we re-navigate to something else
WV.jsRunAsync "test", 2, 3
End Sub
Private Sub WV_NavigationCompleted(ByVal IsSuccess As Boolean, ByVal WebErrorStatus As Long)
Debug.Print "NavigationCompleted welaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
End Sub
Private Sub picWV_Resize() 'when the hosting picBox got resized, we have to call a syncSize-method on the WebView
If Not WV Is Nothing Then WV.SyncSizeToHostWindow
End Sub
Private Sub picWV_GotFocus() 'same thing here... when the hosting picBox got the focus, we tell the WebView about it
If Not WV Is Nothing Then WV.SetFocus
End Sub
'*** the above two EventHandlers (of the hosting VB-PicBox-Container-Ctl) are basically all what's needed "GUI-Binding-wise"
'*** the rest of the EventHandlers below, are raised by the WebView-instance itself
Private Sub WV_InitComplete()
Debug.Print "WV_InitComplete"
End Sub
'Private Sub WV_NavigationCompleted(ByVal IsSuccess As Long, ByVal WebErrorStatus As Long)
'Debug.Print "WV_NavigationCompleted"
'End Sub
Private Sub WV_DocumentComplete()
Debug.Print "WV_DocumentComplete"
End Sub
Private Sub WV_GotFocus(ByVal Reason As eWebView2FocusReason)
Debug.Print "WV_GotFocus", Reason
End Sub
Private Sub WV_JSAsyncResult(Result As Variant, ByVal Token As Currency, ByVal ErrString As String)
Debug.Print "WV_JSAsyncResult "; Result, Token, ErrString
Text2.Text = Result
End Sub
Private Sub WV_JSMessage(ByVal sMsg As String, ByVal sMsgContent As String, oJSONContent As cCollection)
Debug.Print sMsg, sMsgContent
Select Case sMsg
Case "btn1_click": MsgBox "txt1.value: " & WV.jsProp("document.getElementById('txt1').value")
End Select
End Sub
Private Sub WV_LostFocus(ByVal Reason As eWebView2FocusReason)
Debug.Print "WV_LostFocus", Reason
End Sub
Private Sub WV_UserContextMenu(ByVal ScreenX As Long, ByVal SreenY As Long)
Debug.Print "WV_UserContextMenu", ScreenX, SreenY
End Sub
Why does my walk not work but the run works properly sonic the hedgehog animation.
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Image = My.Resources.SONICRUN1_removebg_preview
Timer1.Stop()
Timer2.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
PictureBox1.Image = My.Resources.SONICRUN2_removebg_preview
Timer2.Stop()
Timer1.Start()
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
PictureBox1.Image = My.Resources.SONICRUN3_removebg_preview
Timer3.Stop()
Timer2.Start()
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
PictureBox1.Image = My.Resources.SONICRUN4_removebg_preview
Timer4.Stop()
Timer3.Start()
End Sub
Private Sub btnRUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRUN.Click
Timer1.Enabled = True
Timer5.Enabled = False
End Sub
Private Sub btnWALK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWALK.Click
Timer5.Enabled = True
Timer1.Enabled = False
End Sub
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
PictureBox1.Image = My.Resources.SONICWALK1_removebg_preview
Timer5.Stop()
Timer4.Start()
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
PictureBox1.Image = My.Resources.SONICWALK2_removebg_preview
Timer6.Stop()
Timer5.Start()
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
PictureBox1.Image = My.Resources.SONICWALK3_removebg_preview
Timer7.Stop()
Timer6.Start()
End Sub
Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer8.Tick
PictureBox1.Image = My.Resources.SONICWALK4_removebg_preview
Timer8.Stop()
Timer7.Start()
End Sub
Private Sub Timer9_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer9.Tick
PictureBox1.Image = My.Resources.SONICWALK5_removebg_preview
Timer9.Stop()
Timer8.Start()
End Sub
Private Sub Timer10_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer10.Tick
PictureBox1.Image = My.Resources.SONICWALK6_removebg_preview
Timer10.Stop()
Timer9.Start()
End Sub
Private Sub Timer11_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer11.Tick
PictureBox1.Image = My.Resources.SONICWALK7_removebg_preview
Timer11.Stop()
Timer10.Start()
End Sub
Private Sub Timer12_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer12.Tick
PictureBox1.Image = My.Resources.SONICWALK8_removebg_preview
Timer12.Stop()
Timer11.Start()
End Sub
End Class
I tried doing it again erased it and it still didn't walk he was still running.
When I press the run it works ok. But when I press the walk it won't do the walk animation! Also when I start the program it starts running already. I want it to not run when the program is started I want it to run when I press the buttons.
The Run command starts Timer1. When Timer1 is done it starts Timer2. When Timer2 is done it goes back to Timer1. So run is just toggling back and forth between Timer1 and Timer2.
The Walk command starts Timer5, which starts Timer4 --> Timer3 --> Timer2 --> Timer1...and then gets stuck in the Run cycle toggling between Timer1 and Timer2.
What should the Walk sequence be?
If you don't want anything to be animating, then select each Timer and set the Enabled property to FALSE. Make sure you aren't turning any Timers on in the Load() event of your Form.
Try something like this out:
Public Class Form1
Private runSequence() As Image
Private walkSequence() As Image
Private runIndex As Integer = -1
Private walkIndex As Integer = -1
Private WithEvents trmRun As New System.Windows.Forms.Timer
Private WithEvents trmWalk As New System.Windows.Forms.Timer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
runSequence = {My.Resources.SONICRUN1_removebg_preview, My.Resources.SONICRUN2_removebg_preview,
My.Resources.SONICRUN3_removebg_preview, My.Resources.SONICRUN4_removebg_preview}
walkSequence = {My.Resources.SONICWALK1_removebg_preview, My.Resources.SONICWALK2_removebg_preview,
My.Resources.SONICWALK3_removebg_preview, My.Resources.SONICWALK4_removebg_preview,
My.Resources.SONICWALK5_removebg_preview, My.Resources.SONICWALK6_removebg_preview,
My.Resources.SONICWALK7_removebg_preview, My.Resources.SONICWALK8_removebg_preview}
trmRun.Interval = 100
trmRun.Enabled = False
trmWalk.Interval = 100
trmWalk.Enabled = False
End Sub
Private Sub btnRUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
trmWalk.Stop()
trmRun.Start()
End Sub
Private Sub btnWALK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWalk.Click
trmRun.Stop()
trmWalk.Start()
End Sub
Private Sub trmRun_Tick(sender As Object, e As EventArgs) Handles trmRun.Tick
runIndex = runIndex + 1
If runIndex = runSequence.Length Then
runIndex = 0
End If
PictureBox1.Image = runSequence(runIndex)
End Sub
Private Sub trmWalk_Tick(sender As Object, e As EventArgs) Handles trmWalk.Tick
walkIndex = walkIndex + 1
If walkIndex = walkSequence.Length Then
walkIndex = 0
End If
PictureBox1.Image = walkSequence(walkIndex)
End Sub
End Class
hi its a catalogue application
I have 50 pictures on my folder but i want in the app load show 12 pictures in 12 picturebox
i use this code but it gives me nothing
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic As PictureBox
For i = 0 To 12
pic = Me.Controls("picturebox" & i)
pic.Image = Image.FromFile("C:\Dev\Images\TEST400.jpg")
Next i
End Sub
Help plz
Your image files should be saved as TEST1.jpg,TEST2.jpg, ......TEST12.jpg etc.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic As PictureBox
For i = 1 To 12
pic = Me.Controls("picturebox" & i)
pic.Image = Image.FromFile(#"C:\Dev\Images\TEST" + i.ToString +".jpg")
Next i
End Sub
Note: I just wrote this code here only. Its not tested.
I really need some help with this dilemma.
I have two pictures of a light bulb. In one picture the light bulb is shining brightly and in the other it’s turned off. I’m supposed to overlap these pics and make it turn on and off by clicking on the image but I just can’t figure out the code for it. How do you toggle between these images? I am not allowed to use a button to do this. I've got to click on the pic to change it. Please help! Link below as I do not have enough rep to post actual images yet.
http://i1293.photobucket.com/albums/b598/BentoBoy1/ScreenHunter_02Sep202252_zps75800aea.png
Public Class Form1
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
'Close the program
Me.Close()
End Sub
Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
'Print the form in the print preview window
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Turn the light bulb on.
MessageLabel.Text = "Turn on the light"
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MessageLabel.Click
'Display different messages when the light bulbs are clicked.
End Sub
Private Sub RedRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedRadioButton.CheckedChanged
'Set the MessageLabel text to Red.
MessageLabel.ForeColor = Color.Red
End Sub
Private Sub BlackRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlackRadioButton.CheckedChanged
'Set the MessageLabel text to Black.
MessageLabel.ForeColor = Color.Black
End Sub
Private Sub BlueRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlueRadioButton.CheckedChanged
'Set the MessageLabel text to Blue.
MessageLabel.ForeColor = Color.Blue
End Sub
Private Sub GreenRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GreenRadioButton.CheckedChanged
'Set the MessageLabel text to Green.
MessageLabel.ForeColor = Color.Green
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgrammedByLabel.Click
'Programmed by me.
End Sub
Private Sub ColorsGroupBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorsGroupBox.Enter
'Group of different colors.
End Sub
Private Sub NameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NameTextBox.TextChanged
'Name field.
End Sub
Private Sub PictureBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LightOnPictureBox.Click
'Light bulb is on.
LightOnPictureBox.Image = My.Resources.lighton
MessageLabel.Text = "Thanks for turning me on, " & NameTextBox.Text
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LightOffPictureBox.Click
'Light bulb is off.
LightOffPictureBox.Image = My.Resources.lightoff
MessageLabel.Text = "Thanks for turning me off, " & NameTextBox.Text
End Sub
Private Sub NameLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NameLabel.Click
'Name label.
End Sub
End Class
Firstly, i think that you should take a look here in order to understand the way images comparisson takes place. Secondly, the proper event to change the picture is the PictureBox.Click...
The code should be like the following one:
Public Class Form1
Dim imageBulbOff As Image = My.Resources.BulbOff
Dim imageBulbOn As Image = My.Resources.BulbOn
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
PictureBox1.Image = imageBulbOff
End Sub
Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click
If PictureBox1.Image Is imageBulbOff Then
PictureBox1.Image = imageBulbOn
Else
PictureBox1.Image = imageBulbOff
End If
End Sub
End Class
I am trying to write 2 simple subroutines in VB 2010 that could be used with toolstripbutton contorls for multiple textboxes in a form. I know simple copy paste could be done using the textbox1.Copy() and TextBox1.Paste() methodes. What i am trying to do is write a common subroutine which could be used on any textboxes in the form not just one particular textbox.
My codes are below, I know there are errors in it, just wondering how it could be achieved. Any help would be highly appreciated. Thanks.
Public Class Form1
Private Sub copytext()
Dim txt As Control
If TypeOf txt Is TextBox Then
Clipboard.Clear()
Clipboard.SetText(txt.SelectedText)
End If
End Sub
Private Sub pastetext()
Dim txt As Control
If TypeOf txt Is TextBox Then
txt.Text = Clipboard.GetText
End If
End Sub
Private Sub mnuCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCopy.Click
Call copytext()
End Sub
Private Sub mnuPaste_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPaste.Click
Call pastetext()
End Sub
End Class