Dobrý deň, mám tento kód v VB. Ale vyhadzuje sa mi táto chyba. Možno je to dáka maličkosť ale neviem si s ňou poradiť. Pomôžete mi ? Vďaka.
Kód:
Public Class Form1
'Webcam
Public Touchless As New TouchlessLib.TouchlessMgr
Public Camera1 As TouchlessLib.Camera = Touchless.Cameras.Item(0)
Dim poc As Integer
Dim saveName As Double
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Touchless.CurrentCamera = Camera1
Touchless.CurrentCamera.CaptureHeight = 480
Touchless.CurrentCamera.CaptureWidth = 640
poc += "0"
saveName += ""
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
If TextBox3.Text = "1a2b3c" Then
Timer1.Start()
Me.BackgroundImage = Image.FromFile("C:\Users\user\Documents\Visual Studio 2012\Projects\PcProtect\PcProtect\Resources\granted.jpg")
PictureBox2.Visible = False
Else
poc += "1"
saveName += "C:\Users\user\Desktop" + poc + ".jpg"
PictureBox2.Image = Touchless.CurrentCamera.GetCurrentImage
Touchless.CurrentCamera.GetCurrentImage.Save(saveName)
Me.BackgroundImage = Image.FromFile("C:\Users\user\Documents\Visual Studio 2012\Projects\PcProtect\PcProtect\Resources\den.jpg")
End If
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Me.Close()
End Sub
End Class
Popis chyby:
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Additional information: Conversion from string "C:\Users\user\Desktop" to type 'Double' is not valid.