Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2012 "Parameter is not valid" Error

$
0
0
The program starts. Then when I click the button it stops and say

Not: The program is in turkish
"Parametre geçerli değil" means Parameter is not valid

Code:

Public Class Form1
    'Tekerlek Koordinatları
    Dim kalem As New Drawing.Pen(Color.Black)
    Dim solx1 As Integer = -13
    Dim soly1 As Integer = -8
    Dim solen As Integer = 10
    Dim solboy As Integer = 15
    Dim sagx1 As Integer = solx1 + solen + 5
    Dim sagy1 As Integer = soly1
    Dim sagen As Integer = 10
    Dim sagboy As Integer = 15
    Dim PI As Single = 3.1416
    Dim angledeg As Integer = 30
    Dim anglerad As Single = (angledeg * PI) / 180



    'Sol Tekerlek Dizisi
    Dim vleft() As String = {200, 210, 190, 220, 220, 190, 0, 190, 200, 230, 220, 180, 190, 190, 190, 180, 210, 220, 200, 200}
    'Sag Tekerlek Dizisi
    Dim vright() As String = {200, 200, 210, 220, 220, 180, 150, 150, 150, 230, 220, 150, 180, 190, 190, 200, 210, 210, 180, 200}

    Dim ti As String  'T ilk
    Dim ts As String 't son
    Dim dt As Single = ts - ti 'Delta t
    Dim t As String 'o anki saniye
    Dim x As String = 327  'merkez x koordinatı
    Dim y As String = 410 'merkez y koordinatı
    Dim teta As String = 270 'teta açısı
    'Değişkenler
    Dim l As Single = sagx1 + (sagen / 2) - (solx1 + (solen / 2)) 'tekerler arası mesafe
    Dim R As Single = (l / 2) * ((vleft(t) + vright(t)) / (vright(t) - vleft(t))) 'dönme ekseni ve ICC arası esafe
    Dim w As Single = (vright(t) - vleft(t)) / l 'açısal hız
    Dim iccx As Single = solx1 - (R * Math.Sin(teta)) 'icc x koordinat
    Dim iccy As Single = soly1 + (R * Math.Cos(teta)) 'icc y koordinat

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Timer1.Start()
        ti = CStr(TextBox1.Text)
        ts = CStr(TextBox2.Text)

    End Sub

    Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles PictureBox1.Paint
        'Tekerleklerin tanimlanmasi
        Dim teker As Rectangle() = {New Rectangle(solx1, soly1, solen, solboy), _
                                  New Rectangle(sagx1, sagy1, sagen, sagboy)}
        'Tekerleklrin donmesi
        e.Graphics.TranslateTransform(x, y) 'Merkez
        e.Graphics.RotateTransform(anglerad) 'Açı
        'Tekerleklerin cizimi
        e.Graphics.DrawRectangles(kalem, teker)
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        'Tekerlek Hareketleri
     
        If vright(t) = vleft(t) Then 'sağ sol teker hızı eşitse
            w = 0
            x = x - ((Math.Sin(dt * w) * (y - iccy)) + (Math.Cos(w * dt) * (x - iccx)) + iccx) 'dt sonra x koordinatı
            y = y - ((Math.Cos(w * dt) * (y - iccy)) + (Math.Sin(w * dt) * (x - iccx)) + iccy) 'dt sonra y koordinatı
            PictureBox1.Invalidate()
        ElseIf vright(t) > vleft(t) Then 'sağ teker sol tekerden hızlıysa
            x = x - ((Math.Sin(dt * w) * (y - iccy)) + (Math.Cos(w * dt) * (x - iccx)) + iccx) 'dt sonra x koordinatı
            y = y - ((Math.Cos(w * dt) * (y - iccy)) + (Math.Sin(w * dt) * (x - iccx)) + iccy) 'dt sonra y koordinatı
            anglerad = anglerad + 1
            PictureBox1.Invalidate()
        ElseIf vleft(t) > vright(t) Then 'sol teker sğ tekerden hızlıysa
            x = x - ((Math.Sin(dt * w) * (y - iccy)) + (Math.Cos(w * dt) * (x - iccx)) + iccx) 'dt sonra x koordinatı
            y = y - ((Math.Cos(w * dt) * (y - iccy)) + (Math.Sin(w * dt) * (x - iccx)) + iccy) 'dt sonra y koordinatı
            anglerad = anglerad - 1
            PictureBox1.Invalidate()
        Else
            anglerad = anglerad + 1
            PictureBox1.Invalidate()
        End If
        't = t + 0.01
        'x = x - ((Math.Sin(dt * w) * (y - iccy)) + (Math.Cos(w * dt) * (x - iccx)) + iccx) 'dt sonra x koordinatı
        'y = y - ((Math.Cos(w * dt) * (y - iccy)) + (Math.Sin(w * dt) * (x - iccx)) + iccy) 'dt sonra y koordinatı

    End Sub

 

End Class



What I am trying to do is : The robot's simulation between time interval. :confused:

The whole code: http://codepaste.net/9biar8

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>