Jump to content

Vb2010'da Kod Problemi


felischaus
 Share

Recommended Posts

İyi günler arkadaşlar, benim sorunum şu, basit bir 2. dereceden kök alma programı yazmak istiyorum visual basic 2010'da ve aşağıdaki gibi bir kod yazdığımda " Value of type 'Double' cannot be converted to 'System.EventArgs' " ve " Value of type 'System.EventArgs' cannot be converted to 'String'. " olmak üzere iki tür hata veriyor, yardımcı olabilir misiniz?

 

 

 

Public Class Form1

 
    Dim a, b, c, d, e, f, g As Integer
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        a = Val(TextBox1.Text)
        b = Val(TextBox2.Text)
        c = Val(TextBox3.Text)
        d = b ^ 2 - 4 * a * c
        If d < 0 Then
            TextBox4.Text = "yok"
            TextBox5.Text = "yok"
        End If
        If d = 0 Then
            e = (-b + (d ^ 0.5)) / (2 * a)
            TextBox4.Text = e
            TextBox5.Text = e
        End If
        If d > 0 Then
            f = (-b - (d ^ 0.5)) / (2 * a)
            g = (-b + (d ^ 0.5)) / (2 * a)
            TextBox4.Text = f
            TextBox5.Text = g
        End If

 

 

Link to comment
Share on other sites

  • Editor

http://prntscr.com/25rkql  resimde işaretlediğim yerde üst kısımda e diye System.EventArguments tipinde değişken tanımlanmış zaten sende aşagıda double tipinde değer aktarmaya çalışmışsın o yüzden değişken ismini daha düzenli bir isim verirsen hata vermeyecektir.

Link to comment
Share on other sites

Çok teşekkürler :) peki o yukarıdaki e değişkenini farklı bir isimle kaydetmek mümkün müdür, 

ByVal sender As System.Object, ByVal e As System.EventArgs değil de, misalen ByVal sender As System.Object, ByVal SE As System.EventArgs  olarak?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...