locked
value of type double cannot be converted to system.event .args RRS feed

  • Question

  • User1337275252 posted

    Hi i am a new bie to visual basic and i keep getting this error message which is beginning to frustrate me, here are my codes please help

    Public Class Form7
    Dim e As Double
    Dim p As Integer
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Form5.Show()
    Me.Close()

    End Sub

    Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
    If CheckBox6.Checked = True Then
    CheckBox5.Checked = False
    Form5.cf16 = 0.01

    End If
    End Sub

    Private Sub CheckBox9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox9.CheckedChanged
    If CheckBox9.Checked = True Then
    CheckBox10.Checked = False
    Form5.cf18 = 0.05
    End If
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
    If CheckBox1.Checked = True Then
    CheckBox2.Checked = False
    Form5.cf14 = 0.05
    End If
    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
    If CheckBox2.Checked = True Then
    CheckBox1.Checked = False
    Form5.cf14 = 0.05
    End If
    End Sub

    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
    If CheckBox3.Checked = True Then
    CheckBox4.Checked = False
    Form5.cf15 = 0.05
    End If
    End Sub

    Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
    If CheckBox4.Checked = True Then
    CheckBox3.Checked = False
    Form5.cf15 = 0.05
    End If
    End Sub

    Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
    If CheckBox5.Checked = True Then
    CheckBox6.Checked = False
    Form5.cf16 = 0.05
    End If
    End Sub

    Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
    If CheckBox7.Checked = True Then
    CheckBox8.Checked = False
    Form5.cf17 = 0.05
    End If
    End Sub

    Private Sub CheckBox8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox8.CheckedChanged
    If CheckBox8.Checked = True Then
    CheckBox7.Checked = False
    Form5.cf17 = 0.01
    End If
    End Sub

    Private Sub CheckBox10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox10.CheckedChanged
    If CheckBox10.Checked = True Then
    CheckBox9.Checked = False
    Form5.cf18 = 0.05
    End If
    End Sub

    Private Sub CheckBox11_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox11.CheckedChanged
    If CheckBox11.Checked = True Then
    CheckBox12.Checked = False
    Form5.cf19 = 0.05
    End If
    End Sub

    Private Sub CheckBox12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox12.CheckedChanged
    If CheckBox12.Checked = True Then
    CheckBox11.Checked = False
    Form5.cf19 = 0.05
    End If
    End Sub

    Private Sub CheckBox13_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox13.CheckedChanged
    If CheckBox13.Checked = True Then
    CheckBox14.Checked = False
    Form5.cf20 = 0.05
    End If
    End Sub

    Private Sub CheckBox14_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox14.CheckedChanged
    If CheckBox14.Checked = True Then
    CheckBox13.Checked = False
    Form5.cf20 = 0.05
    End If
    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    e = (Form5.cf1 + Form5.cf2 + Form5.cf3 + Form5.cf4 + Form5.cf5 + Form5.cf6 + Form5.cf7 + Form5.cf8 + Form5.cf9 + Form5.cf10 + Form5.cf11 + Form5.cf12 + Form5.cf13 + Form5.cf14 + Form5.cf15 + Form5.cf16 + Form5.cf17 + Form5.cf18 + Form5.cf19 + Form5.cf20) -
    (Form5.cf1 * Form5.cf2 * Form5.cf3 * Form5.cf4 * Form5.cf5 * Form5.cf6 * Form5.cf7 * Form5.cf8 * Form5.cf9 * Form5.cf10 * Form5.cf11 * Form5.cf12 * Form5.cf13 * Form5.cf14 * Form5.cf15 * Form5.cf16 * Form5.cf17 * Form5.cf18 * Form5.cf19 * Form5.cf20).ToString)
    End Sub
    End Class

    Sunday, July 1, 2012 5:10 AM

All replies

  • User-661350001 posted

    may we request you to let us know on which line is that error break at please ? so that i would be easier to help.

    the code which you have posted no where you are converting Double to Args

    Sunday, July 1, 2012 5:48 AM
  • User1337275252 posted

    Ok there are two forms, i declared the variables on the first form with this variables.

    Public Class Form5
    Public cf1 As Long
    Public cf2 As Long
    Public cf3 As Long
    Public cf4 As Long
    Public cf5 As Long
    Public cf6 As Long
    Public cf7 As Long
    Public cf8 As Long
    Public cf9 As Long
    Public cf10 As Long
    Public cf11 As Long
    Public cf12 As Long
    Public cf13 As Long
    Public cf14 As Long
    Public cf15 As Long
    Public cf16 As Long
    Public cf17 As Long
    Public cf18 As Long
    Public cf19 As Long
    Public cf20 As Long

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Form7.Show()
    Me.Hide()
    End Sub

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
    Form1.Show()
    Me.Close()


    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
    If CheckBox1.Checked = True Then
    CheckBox2.Checked = False
    cf1 = 0.05
    End If
    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
    If CheckBox2.Checked = True Then
    CheckBox1.Checked = False
    cf1 = 0.01
    End If
    End Sub

    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
    If CheckBox3.Checked = True Then
    CheckBox4.Checked = False
    cf2 = 0.05
    End If
    End Sub

    Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
    If CheckBox4.Checked = True Then
    CheckBox3.Checked = False
    cf2 = 0.01
    End If
    End Sub

    Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
    If CheckBox5.Checked = True Then
    CheckBox6.Checked = False
    cf3 = 0.05
    End If
    End Sub

    Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
    If CheckBox6.Checked = True Then
    CheckBox5.Checked = False
    cf3 = 0.01
    End If
    End Sub

    Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
    If CheckBox7.Checked = True Then
    CheckBox8.Checked = False
    cf4 = 0.05
    End If
    End Sub

    Private Sub CheckBox8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox8.CheckedChanged
    If CheckBox8.Checked = True Then
    CheckBox7.Checked = False
    cf4 = 0.01
    End If
    End Sub

    Private Sub CheckBox9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox9.CheckedChanged
    If CheckBox9.Checked = True Then
    CheckBox10.Checked = False
    cf5 = 0.01
    End If
    End Sub

    Private Sub CheckBox10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox10.CheckedChanged
    If CheckBox10.Checked = True Then
    CheckBox9.Checked = False
    cf5 = 0.05
    End If
    End Sub

    Private Sub CheckBox11_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox11.CheckedChanged
    If CheckBox11.Checked = True Then
    CheckBox12.Checked = False
    cf6 = 0.05
    End If
    End Sub

    Private Sub CheckBox12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox12.CheckedChanged
    If CheckBox12.Checked = True Then
    CheckBox11.Checked = False
    cf6 = 0.01
    End If
    End Sub

    Private Sub CheckBox13_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox13.CheckedChanged
    If CheckBox13.Checked = True Then
    CheckBox14.Checked = False
    cf7 = 0.05
    End If
    End Sub

    Private Sub CheckBox14_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox14.CheckedChanged
    If CheckBox14.Checked = True Then
    CheckBox13.Checked = False
    cf7 = 0.01
    End If
    End Sub

    Private Sub CheckBox15_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox15.CheckedChanged
    If CheckBox15.Checked = True Then
    CheckBox16.Checked = False
    cf8 = 0.05
    End If
    End Sub

    Private Sub CheckBox16_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox16.CheckedChanged
    If CheckBox16.Checked = True Then
    CheckBox15.Checked = False
    cf8 = 0.01
    End If
    End Sub

    Private Sub CheckBox17_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox17.CheckedChanged
    If CheckBox17.Checked = True Then
    CheckBox18.Checked = False
    cf9 = 0.05
    End If
    End Sub

    Private Sub CheckBox18_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox18.CheckedChanged
    If CheckBox18.Checked = True Then
    CheckBox17.Checked = False
    cf9 = 0.01
    End If
    End Sub

    Private Sub CheckBox19_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox19.CheckedChanged
    If CheckBox19.Checked = True Then
    CheckBox20.Checked = False
    cf10 = 0.05
    End If
    End Sub

    Private Sub CheckBox20_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox20.CheckedChanged
    If CheckBox20.Checked = True Then
    CheckBox19.Checked = False
    cf10 = 0.01
    End If
    End Sub

    Private Sub CheckBox21_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox21.CheckedChanged
    If CheckBox21.Checked = True Then
    CheckBox22.Checked = False
    cf11 = 0.05
    End If
    End Sub

    Private Sub CheckBox22_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox22.CheckedChanged
    If CheckBox22.Checked = True Then
    CheckBox21.Checked = False
    cf11 = 0.01
    End If
    End Sub

    Private Sub CheckBox23_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox23.CheckedChanged
    If CheckBox23.Checked = True Then
    CheckBox24.Checked = False
    cf12 = 0.05
    End If
    End Sub

    Private Sub CheckBox24_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox24.CheckedChanged
    If CheckBox24.Checked = True Then
    CheckBox23.Checked = False
    cf12 = 0.01
    End If
    End Sub

    Private Sub CheckBox25_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox25.CheckedChanged
    If CheckBox25.Checked = True Then
    CheckBox26.Checked = False
    cf13 = 0.05
    End If
    End Sub

    Private Sub CheckBox26_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox26.CheckedChanged
    If CheckBox26.Checked = True Then
    CheckBox25.Checked = False
    cf13 = 0.01
    End If
    End Sub
    End Class

    On the second form i then called the variables from the first form and the coding i was what i posted before, the line i am having the problem is here

    e = (Form5.cf1 + Form5.cf2 + Form5.cf3 + Form5.cf4 + Form5.cf5 + Form5.cf6 + Form5.cf7 + Form5.cf8 + Form5.cf9 + Form5.cf10 + Form5.cf11 + Form5.cf12 + Form5.cf13 + Form5.cf14 + Form5.cf15 + Form5.cf16 + Form5.cf17 + Form5.cf18 + Form5.cf19 + Form5.cf20) -
    (Form5.cf1 * Form5.cf2 * Form5.cf3 * Form5.cf4 * Form5.cf5 * Form5.cf6 * Form5.cf7 * Form5.cf8 * Form5.cf9 * Form5.cf10 * Form5.cf11 * Form5.cf12 * Form5.cf13 * Form5.cf14 * Form5.cf15 * Form5.cf16 * Form5.cf17 * Form5.cf18 * Form5.cf19 * Form5.cf20)
    End Sub

     

    Sunday, July 1, 2012 11:24 AM