14 Replies - 1455 Views - Last Post: 08 October 2012 - 10:44 PM Rate Topic: -----

#1 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 11:30 AM

Inherits System.Windows.Forms.Form
    Dim cperson, company, address, cat, dae1, dae2 As String
    Dim phone, noatt, costatt As Integer


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Label12 As System.Windows.Forms.Label
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents Label17 As System.Windows.Forms.Label
    Friend WithEvents Label18 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents Panel2 As System.Windows.Forms.Panel
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label19 As System.Windows.Forms.Label
    Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
    Friend WithEvents DateTimePicker2 As System.Windows.Forms.DateTimePicker
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Label20 As System.Windows.Forms.Label
    Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
    Friend WithEvents Label21 As System.Windows.Forms.Label
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
    Friend WithEvents Panel3 As System.Windows.Forms.Panel
    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox5 As System.Windows.Forms.CheckBox
    Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
    Friend WithEvents Button4 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(eventrf))
        Me.Label1 = New System.Windows.Forms.Label
        Me.Panel1 = New System.Windows.Forms.Panel
        Me.Panel2 = New System.Windows.Forms.Panel
        Me.Button4 = New System.Windows.Forms.Button
        Me.ComboBox2 = New System.Windows.Forms.ComboBox
        Me.Panel3 = New System.Windows.Forms.Panel
        Me.CheckBox5 = New System.Windows.Forms.CheckBox
        Me.CheckBox4 = New System.Windows.Forms.CheckBox
        Me.CheckBox3 = New System.Windows.Forms.CheckBox
        Me.CheckBox2 = New System.Windows.Forms.CheckBox
        Me.CheckBox1 = New System.Windows.Forms.CheckBox
        Me.ComboBox1 = New System.Windows.Forms.ComboBox
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button1 = New System.Windows.Forms.Button
        Me.DateTimePicker2 = New System.Windows.Forms.DateTimePicker
        Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Label21 = New System.Windows.Forms.Label
        Me.TextBox6 = New System.Windows.Forms.TextBox
        Me.Label20 = New System.Windows.Forms.Label
        Me.RadioButton2 = New System.Windows.Forms.RadioButton
        Me.RadioButton1 = New System.Windows.Forms.RadioButton
        Me.TextBox5 = New System.Windows.Forms.TextBox
        Me.Label19 = New System.Windows.Forms.Label
        Me.Label18 = New System.Windows.Forms.Label
        Me.Label12 = New System.Windows.Forms.Label
        Me.Label14 = New System.Windows.Forms.Label
        Me.Label16 = New System.Windows.Forms.Label
        Me.Label13 = New System.Windows.Forms.Label
        Me.Label15 = New System.Windows.Forms.Label
        Me.Label11 = New System.Windows.Forms.Label
        Me.Label17 = New System.Windows.Forms.Label
        Me.TextBox4 = New System.Windows.Forms.TextBox
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label10 = New System.Windows.Forms.Label
        Me.Label9 = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.Panel1.SuspendLayout()
        Me.Panel2.SuspendLayout()
        Me.Panel3.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Anchor = System.Windows.Forms.AnchorStyles.Top
        Me.Label1.Font = New System.Drawing.Font("Viner Hand ITC", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(269, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(832, 48)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "MerryMeetings Events Organizers "
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Panel1
        '
        Me.Panel1.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel1.Controls.Add(Me.Panel2)
        Me.Panel1.Controls.Add(Me.TextBox4)
        Me.Panel1.Controls.Add(Me.TextBox3)
        Me.Panel1.Controls.Add(Me.TextBox2)
        Me.Panel1.Controls.Add(Me.TextBox1)
        Me.Panel1.Controls.Add(Me.Label10)
        Me.Panel1.Controls.Add(Me.Label9)
        Me.Panel1.Controls.Add(Me.Label8)
        Me.Panel1.Controls.Add(Me.Label7)
        Me.Panel1.Controls.Add(Me.Label6)
        Me.Panel1.Controls.Add(Me.Label5)
        Me.Panel1.Controls.Add(Me.Label4)
        Me.Panel1.Controls.Add(Me.Label3)
        Me.Panel1.Controls.Add(Me.Label2)
        Me.Panel1.Cursor = System.Windows.Forms.Cursors.PanNW
        Me.Panel1.Location = New System.Drawing.Point(89, 19)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(1120, 664)
        Me.Panel1.TabIndex = 2
        '
        'Panel2
        '
        Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel2.Controls.Add(Me.Button4)
        Me.Panel2.Controls.Add(Me.ComboBox2)
        Me.Panel2.Controls.Add(Me.Panel3)
        Me.Panel2.Controls.Add(Me.ComboBox1)
        Me.Panel2.Controls.Add(Me.Button3)
        Me.Panel2.Controls.Add(Me.Button2)
        Me.Panel2.Controls.Add(Me.Button1)
        Me.Panel2.Controls.Add(Me.DateTimePicker2)
        Me.Panel2.Controls.Add(Me.DateTimePicker1)
        Me.Panel2.Controls.Add(Me.GroupBox1)
        Me.Panel2.Controls.Add(Me.Label12)
        Me.Panel2.Controls.Add(Me.Label14)
        Me.Panel2.Controls.Add(Me.Label16)
        Me.Panel2.Controls.Add(Me.Label13)
        Me.Panel2.Controls.Add(Me.Label15)
        Me.Panel2.Controls.Add(Me.Label11)
        Me.Panel2.Controls.Add(Me.Label17)
        Me.Panel2.Cursor = System.Windows.Forms.Cursors.Arrow
        Me.Panel2.Location = New System.Drawing.Point(0, 208)
        Me.Panel2.Name = "Panel2"
        Me.Panel2.Size = New System.Drawing.Size(1072, 432)
        Me.Panel2.TabIndex = 21
        '
        'Button4
        '
        Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Button4.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button4.Location = New System.Drawing.Point(632, 344)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(80, 64)
        Me.Button4.TabIndex = 34
        Me.Button4.Text = "Verify"
        '
        'ComboBox2
        '
        Me.ComboBox2.BackColor = System.Drawing.SystemColors.WindowFrame
        Me.ComboBox2.ForeColor = System.Drawing.Color.Lime
        Me.ComboBox2.Location = New System.Drawing.Point(224, 136)
        Me.ComboBox2.Name = "ComboBox2"
        Me.ComboBox2.Size = New System.Drawing.Size(312, 26)
        Me.ComboBox2.TabIndex = 27
        '
        'Panel3
        '
        Me.Panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel3.Controls.Add(Me.CheckBox5)
        Me.Panel3.Controls.Add(Me.CheckBox4)
        Me.Panel3.Controls.Add(Me.CheckBox3)
        Me.Panel3.Controls.Add(Me.CheckBox2)
        Me.Panel3.Controls.Add(Me.CheckBox1)
        Me.Panel3.Location = New System.Drawing.Point(224, 96)
        Me.Panel3.Name = "Panel3"
        Me.Panel3.Size = New System.Drawing.Size(824, 32)
        Me.Panel3.TabIndex = 27
        '
        'CheckBox5
        '
        Me.CheckBox5.Location = New System.Drawing.Point(656, 0)
        Me.CheckBox5.Name = "CheckBox5"
        Me.CheckBox5.Size = New System.Drawing.Size(168, 24)
        Me.CheckBox5.TabIndex = 26
        Me.CheckBox5.Text = "Air Conditioning"
        '
        'CheckBox4
        '
        Me.CheckBox4.Location = New System.Drawing.Point(496, 0)
        Me.CheckBox4.Name = "CheckBox4"
        Me.CheckBox4.TabIndex = 25
        Me.CheckBox4.Text = "Catering"
        '
        'CheckBox3
        '
        Me.CheckBox3.Location = New System.Drawing.Point(344, 0)
        Me.CheckBox3.Name = "CheckBox3"
        Me.CheckBox3.TabIndex = 24
        Me.CheckBox3.Text = "Decore"
        '
        'CheckBox2
        '
        Me.CheckBox2.Location = New System.Drawing.Point(184, 0)
        Me.CheckBox2.Name = "CheckBox2"
        Me.CheckBox2.TabIndex = 23
        Me.CheckBox2.Text = "Parking"
        '
        'CheckBox1
        '
        Me.CheckBox1.Location = New System.Drawing.Point(8, 0)
        Me.CheckBox1.Name = "CheckBox1"
        Me.CheckBox1.TabIndex = 22
        Me.CheckBox1.Text = "Toilets"
        '
        'ComboBox1
        '
        Me.ComboBox1.BackColor = System.Drawing.SystemColors.InfoText
        Me.ComboBox1.ForeColor = System.Drawing.Color.HotPink
        Me.ComboBox1.Items.AddRange(New Object() {"Product Launch", "Conference", "Corporate Hospitality", "Recruitment", "Information Distribution", "Technical Seminars", "Other"})
        Me.ComboBox1.Location = New System.Drawing.Point(224, 56)
        Me.ComboBox1.Name = "ComboBox1"
        Me.ComboBox1.Size = New System.Drawing.Size(312, 26)
        Me.ComboBox1.TabIndex = 21
        '
        'Button3
        '
        Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Button3.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button3.Location = New System.Drawing.Point(952, 344)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(80, 64)
        Me.Button3.TabIndex = 37
        Me.Button3.Text = "Main Menu"
        '
        'Button2
        '
        Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Button2.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button2.Location = New System.Drawing.Point(848, 344)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(80, 64)
        Me.Button2.TabIndex = 36
        Me.Button2.Text = "Clear"
        '
        'Button1
        '
        Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Button1.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button1.Location = New System.Drawing.Point(736, 344)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(80, 64)
        Me.Button1.TabIndex = 35
        Me.Button1.Text = "Accept "
        Me.Button1.Visible = False
        '
        'DateTimePicker2
        '
        Me.DateTimePicker2.CalendarForeColor = System.Drawing.Color.HotPink
        Me.DateTimePicker2.CalendarMonthBackground = System.Drawing.SystemColors.MenuText
        Me.DateTimePicker2.CalendarTitleBackColor = System.Drawing.Color.Red
        Me.DateTimePicker2.Location = New System.Drawing.Point(224, 208)
        Me.DateTimePicker2.Name = "DateTimePicker2"
        Me.DateTimePicker2.Size = New System.Drawing.Size(312, 27)
        Me.DateTimePicker2.TabIndex = 29
        '
        'DateTimePicker1
        '
        Me.DateTimePicker1.CalendarForeColor = System.Drawing.Color.HotPink
        Me.DateTimePicker1.CalendarMonthBackground = System.Drawing.SystemColors.MenuText
        Me.DateTimePicker1.CalendarTitleBackColor = System.Drawing.Color.Red
        Me.DateTimePicker1.CalendarTitleForeColor = System.Drawing.Color.Lime
        Me.DateTimePicker1.Location = New System.Drawing.Point(224, 168)
        Me.DateTimePicker1.Name = "DateTimePicker1"
        Me.DateTimePicker1.Size = New System.Drawing.Size(312, 27)
        Me.DateTimePicker1.TabIndex = 28
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Label21)
        Me.GroupBox1.Controls.Add(Me.TextBox6)
        Me.GroupBox1.Controls.Add(Me.Label20)
        Me.GroupBox1.Controls.Add(Me.RadioButton2)
        Me.GroupBox1.Controls.Add(Me.RadioButton1)
        Me.GroupBox1.Controls.Add(Me.TextBox5)
        Me.GroupBox1.Controls.Add(Me.Label19)
        Me.GroupBox1.Controls.Add(Me.Label18)
        Me.GroupBox1.Location = New System.Drawing.Point(8, 256)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(560, 192)
        Me.GroupBox1.TabIndex = 17
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Attendees"
        '
        'Label21
        '
        Me.Label21.Location = New System.Drawing.Point(232, 136)
        Me.Label21.Name = "Label21"
        Me.Label21.Size = New System.Drawing.Size(24, 23)
        Me.Label21.TabIndex = 24
        Me.Label21.Text = "R"
        '
        'TextBox6
        '
        Me.TextBox6.BackColor = System.Drawing.SystemColors.MenuText
        Me.TextBox6.ForeColor = System.Drawing.Color.HotPink
        Me.TextBox6.Location = New System.Drawing.Point(256, 136)
        Me.TextBox6.Name = "TextBox6"
        Me.TextBox6.Size = New System.Drawing.Size(64, 27)
        Me.TextBox6.TabIndex = 33
        Me.TextBox6.Text = ""
        '
        'Label20
        '
        Me.Label20.Location = New System.Drawing.Point(8, 136)
        Me.Label20.Name = "Label20"
        Me.Label20.Size = New System.Drawing.Size(176, 23)
        Me.Label20.TabIndex = 22
        Me.Label20.Text = "Cost to Attendee:"
        '
        'RadioButton2
        '
        Me.RadioButton2.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.RadioButton2.Location = New System.Drawing.Point(360, 40)
        Me.RadioButton2.Name = "RadioButton2"
        Me.RadioButton2.Size = New System.Drawing.Size(56, 24)
        Me.RadioButton2.TabIndex = 31
        Me.RadioButton2.Text = "NO"
        '
        'RadioButton1
        '
        Me.RadioButton1.Checked = True
        Me.RadioButton1.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.RadioButton1.Location = New System.Drawing.Point(264, 40)
        Me.RadioButton1.Name = "RadioButton1"
        Me.RadioButton1.Size = New System.Drawing.Size(56, 24)
        Me.RadioButton1.TabIndex = 30
        Me.RadioButton1.TabStop = True
        Me.RadioButton1.Text = "YES"
        '
        'TextBox5
        '
        Me.TextBox5.BackColor = System.Drawing.SystemColors.MenuText
        Me.TextBox5.ForeColor = System.Drawing.Color.HotPink
        Me.TextBox5.Location = New System.Drawing.Point(256, 96)
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.Size = New System.Drawing.Size(64, 27)
        Me.TextBox5.TabIndex = 32
        Me.TextBox5.Text = ""
        '
        'Label19
        '
        Me.Label19.Location = New System.Drawing.Point(8, 96)
        Me.Label19.Name = "Label19"
        Me.Label19.Size = New System.Drawing.Size(192, 23)
        Me.Label19.TabIndex = 17
        Me.Label19.Text = "Number of attendees:"
        '
        'Label18
        '
        Me.Label18.Location = New System.Drawing.Point(8, 40)
        Me.Label18.Name = "Label18"
        Me.Label18.Size = New System.Drawing.Size(216, 23)
        Me.Label18.TabIndex = 16
        Me.Label18.Text = "Arrange for attendees?"
        '
        'Label12
        '
        Me.Label12.Location = New System.Drawing.Point(16, 96)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(176, 23)
        Me.Label12.TabIndex = 10
        Me.Label12.Text = "Facilities Required:"
        '
        'Label14
        '
        Me.Label14.Location = New System.Drawing.Point(16, 136)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(152, 23)
        Me.Label14.TabIndex = 12
        Me.Label14.Text = "Preferred Venue:"
        '
        'Label16
        '
        Me.Label16.Location = New System.Drawing.Point(16, 208)
        Me.Label16.Name = "Label16"
        Me.Label16.TabIndex = 14
        Me.Label16.Text = "End date:"
        '
        'Label13
        '
        Me.Label13.Font = New System.Drawing.Font("Viner Hand ITC", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label13.Location = New System.Drawing.Point(0, 0)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(440, 23)
        Me.Label13.TabIndex = 11
        Me.Label13.Text = "Event Requirements:(All fields are mandatory)"
        '
        'Label15
        '
        Me.Label15.Location = New System.Drawing.Point(16, 64)
        Me.Label15.Name = "Label15"
        Me.Label15.TabIndex = 13
        Me.Label15.Text = "Category:"
        '
        'Label11
        '
        Me.Label11.Location = New System.Drawing.Point(16, -48)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(100, 37)
        Me.Label11.TabIndex = 9
        Me.Label11.Text = "Label11"
        '
        'Label17
        '
        Me.Label17.Location = New System.Drawing.Point(16, 176)
        Me.Label17.Name = "Label17"
        Me.Label17.TabIndex = 15
        Me.Label17.Text = "Start date:"
        '
        'TextBox4
        '
        Me.TextBox4.BackColor = System.Drawing.Color.Black
        Me.TextBox4.ForeColor = System.Drawing.Color.HotPink
        Me.TextBox4.Location = New System.Drawing.Point(176, 168)
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.Size = New System.Drawing.Size(248, 27)
        Me.TextBox4.TabIndex = 20
        Me.TextBox4.Text = ""
        '
        'TextBox3
        '
        Me.TextBox3.BackColor = System.Drawing.Color.Black
        Me.TextBox3.ForeColor = System.Drawing.Color.HotPink
        Me.TextBox3.Location = New System.Drawing.Point(176, 128)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.Size = New System.Drawing.Size(248, 27)
        Me.TextBox3.TabIndex = 19
        Me.TextBox3.Text = ""
        '
        'TextBox2
        '
        Me.TextBox2.BackColor = System.Drawing.Color.Black
        Me.TextBox2.ForeColor = System.Drawing.Color.HotPink
        Me.TextBox2.Location = New System.Drawing.Point(176, 88)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(248, 27)
        Me.TextBox2.TabIndex = 18
        Me.TextBox2.Text = ""
        '
        'TextBox1
        '
        Me.TextBox1.BackColor = System.Drawing.Color.Black
        Me.TextBox1.ForeColor = System.Drawing.Color.HotPink
        Me.TextBox1.Location = New System.Drawing.Point(176, 48)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(248, 27)
        Me.TextBox1.TabIndex = 17
        Me.TextBox1.Text = ""
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(440, 168)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(368, 23)
        Me.Label10.TabIndex = 8
        Me.Label10.Text = "(Can be personal or company's address *)"
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(0, 168)
        Me.Label9.Name = "Label9"
        Me.Label9.TabIndex = 7
        Me.Label9.Text = "Address:"
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(440, 128)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(232, 23)
        Me.Label8.TabIndex = 6
        Me.Label8.Text = "(Name of the Company *)"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(0, 128)
        Me.Label7.Name = "Label7"
        Me.Label7.TabIndex = 5
        Me.Label7.Text = "Company:"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(440, 88)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(248, 23)
        Me.Label6.TabIndex = 4
        Me.Label6.Text = "(Contact Phone Number *)"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(0, 88)
        Me.Label5.Name = "Label5"
        Me.Label5.TabIndex = 3
        Me.Label5.Text = "Phone:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(440, 48)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(184, 23)
        Me.Label4.TabIndex = 2
        Me.Label4.Text = "(Full Name*)"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(0, 48)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(144, 24)
        Me.Label3.TabIndex = 1
        Me.Label3.Text = "Contact Person:"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("Viner Hand ITC", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(0, 0)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(488, 23)
        Me.Label2.TabIndex = 0
        Me.Label2.Text = "Personal Details(Fields with(*) are mandatory)"
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(0, 0)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(56, 48)
        Me.PictureBox1.TabIndex = 15
        Me.PictureBox1.TabStop = False
        '
        'eventrf
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(9, 20)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(1370, 641)
        Me.ControlBox = False
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.Label1)
        Me.Cursor = System.Windows.Forms.Cursors.PanNW
        Me.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.Color.Lime
        Me.Name = "eventrf"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Event Registration"
        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
        Me.Panel1.ResumeLayout(False)
        Me.Panel2.ResumeLayout(False)
        Me.Panel3.ResumeLayout(False)
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub eventrf_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim connString As String = "workstation id=RIKESH;packet size=4096;user id=sa;data source=RIKESH;persist security info=False;initial catalog=Merrymeetings"
        Dim myConn As New SqlClient.SqlConnection(connString)
        myConn.Open()

        Dim da As New SqlClient.SqlDataAdapter("Select Venue_Name from Venue_Details", myConn)

        Dim dt As New DataTable
        da.Fill(dt)

        ComboBox2.DisplayMember = "Venue_Name"
        ComboBox2.DataSource = dt

        myConn.Close()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim frmMenu As New MainMenu
        frmMenu.Show()
        Me.Hide()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        cperson = TextBox1.Text
        phone = Val(TextBox2.Text)
        company = TextBox3.Text
        address = TextBox4.Text
        noatt = Val(TextBox5.Text)
        costatt = Val(TextBox6.Text)
        cat = ComboBox1.Text
        Dim venname As String = ComboBox2.SelectedItem.ToString()
        dae1 = DateTimePicker1.Format = DateTimePickerFormat.Custom
        DateTimePicker1.CustomFormat = "dd,MM,yy"
        DateTimePicker1.Format = DateTimePickerFormat.Custom
        dae2 = DateTimePicker2.Format = DateTimePickerFormat.Custom
        DateTimePicker2.CustomFormat = "dd,MM,yy"
        DateTimePicker2.Format = DateTimePickerFormat.Custom
        Dim connetionString As String
        Dim connection As SqlConnection
        connetionString = "workstation id=RIKESH;packet size=4096;user id=sa;data source=RIKESH;persist security info=False;initial catalog=Merrymeetings"
        connection = New SqlConnection(connetionString)
        Dim sqlComm As New SqlCommand
        sqlComm.Connection = connection
        connection.Open()
        sqlComm.CommandType = CommandType.StoredProcedure
        sqlComm.CommandText = "valid"
        sqlComm.Parameters.Add("@Venue_Name", SqlDbType.Char, 30)
        sqlComm.Parameters.Add("@Start_Date", SqlDbType.NVarChar, 8)
        sqlComm.Parameters.Add("@End_Date", SqlDbType.NVarChar, 8)
        sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input
        sqlComm.Parameters("@Start_Date").Direction = ParameterDirection.Input
        sqlComm.Parameters("@End_Date").Direction = ParameterDirection.Input
        sqlComm.Parameters("@Venue_Name").Value = ParameterDirection.Input = ComboBox2.Text
        sqlComm.Parameters("@Start_Date").Value = ParameterDirection.Input = DateTimePicker1.Text
        sqlComm.Parameters("@End_Date").Value = ParameterDirection.Input = DateTimePicker2.Text


        Try
            MessageBox.Show(sqlComm.ExecuteScalar, "This works im happy")
        Catch sqlex As SqlException
            MessageBox.Show(sqlex.Message)
        End Try
        connection.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox1.Focus()
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        ComboBox1.Text = ""
        ComboBox2.Text = ""
        CheckBox1.Checked = False
        CheckBox2.Checked = False
        CheckBox3.Checked = False
        CheckBox4.Checked = False
        CheckBox5.Checked = False
        RadioButton1.Checked = False
        RadioButton2.Checked = False
        DateTimePicker1.ResetText()
        DateTimePicker2.ResetText()
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: An unhandled exception of type 'System.InvalidCastException' o

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 11:31 AM

So you got a lot of code there, any questions that may go with it? Also, post the sections of code where you're having issues, if more is needed we can always ask for it.
Was This Post Helpful? 0
  • +
  • -

#3 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 12:24 PM

I keep getting this error and i have no clue what to do.

Additional information: Cast from string "" to type 'Double' is not valid.

Can u show me where i am going off...
kind of pulling my hair out...


 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        cperson = TextBox1.Text
        phone = Val(TextBox2.Text)
        company = TextBox3.Text
        address = TextBox4.Text
        noatt = Val(TextBox5.Text)
        costatt = Val(TextBox6.Text)
        cat = ComboBox1.Text
        Dim venname As String = ComboBox2.SelectedItem.ToString()
        dae1 = DateTimePicker1.Format = DateTimePickerFormat.Custom
        DateTimePicker1.CustomFormat = "dd,MM,yy"
        DateTimePicker1.Format = DateTimePickerFormat.Custom
        dae2 = DateTimePicker2.Format = DateTimePickerFormat.Custom
        DateTimePicker2.CustomFormat = "dd,MM,yy"
        DateTimePicker2.Format = DateTimePickerFormat.Custom
        Dim connetionString As String
        Dim connection As SqlConnection
        connetionString = "workstation id=RIKESH;packet size=4096;user id=sa;data source=RIKESH;persist security info=False;initial catalog=Merrymeetings"
        connection = New SqlConnection(connetionString)
        Dim sqlComm As New SqlCommand
        sqlComm.Connection = connection
        connection.Open()
        sqlComm.CommandType = CommandType.StoredProcedure
        sqlComm.CommandText = "valid"
        sqlComm.Parameters.Add("@Venue_Name", SqlDbType.Char, 30)
        sqlComm.Parameters.Add("@Start_Date", SqlDbType.NVarChar, 8)
        sqlComm.Parameters.Add("@End_Date", SqlDbType.NVarChar, 8)
        sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input
        sqlComm.Parameters("@Start_Date").Direction = ParameterDirection.Input
        sqlComm.Parameters("@End_Date").Direction = ParameterDirection.Input
        sqlComm.Parameters("@Venue_Name").Value = ParameterDirection.Input = ComboBox2.Text
        sqlComm.Parameters("@Start_Date").Value = ParameterDirection.Input = DateTimePicker1.Text
        sqlComm.Parameters("@End_Date").Value = ParameterDirection.Input = DateTimePicker2.Text


        Try
            MessageBox.Show(sqlComm.ExecuteScalar, "This works im happy")
        Catch sqlex As SqlException
            MessageBox.Show(sqlex.Message)
        End Try
        connection.Close()
    End Sub



it happens when i try to get the value from my combobox and use it in my query. it is used to accept a value from the combobox and 2 datetimepickers. I am trying to check is the venue_name = start_date and end_date.

     DateTimePicker2.Format = DateTimePickerFormat.Custom
16
       Dim connetionString As String
17
       Dim connection As SqlConnection
18
       connetionString = "workstation id=RIKESH;packet size=4096;user id=sa;data source=RIKESH;persist security info=False;initial catalog=Merrymeetings"
19
       connection = New SqlConnection(connetionString)
20
       Dim sqlComm As New SqlCommand
21
       sqlComm.Connection = connection
22
       connection.Open()
23
       sqlComm.CommandType = CommandType.StoredProcedure
24
       sqlComm.CommandText = "valid"
25
       sqlComm.Parameters.Add("@Venue_Name", SqlDbType.Char, 30)
26
       sqlComm.Parameters.Add("@Start_Date", SqlDbType.NVarChar, 8)
27
       sqlComm.Parameters.Add("@End_Date", SqlDbType.NVarChar, 8)
28
       sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input
29
       sqlComm.Parameters("@Start_Date").Direction = ParameterDirection.Input
30
       sqlComm.Parameters("@End_Date").Direction = ParameterDirection.Input
31
       sqlComm.Parameters("@Venue_Name").Value = ParameterDirection.Input = ComboBox2.Text
32
       sqlComm.Parameters("@Start_Date").Value = ParameterDirection.Input = DateTimePicker1.Text
33
       sqlComm.Parameters("@End_Date").Value = ParameterDirection.Input = DateTimePicker2.Text
34
 
35
 
36
       Try
37
           MessageBox.Show(sqlComm.ExecuteScalar, "This works im happy")
38
       Catch sqlex As SqlException
39
           MessageBox.Show(sqlex.Message)
40
       End Try
41
       connection.Close()


Was This Post Helpful? 0
  • +
  • -

#4 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 12:30 PM

Well, an empty string "" definitely cannot be convert to double so you need to find out why that string is empty.
Was This Post Helpful? 0
  • +
  • -

#5 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 01:23 PM

View PostCharlieMay, on 08 October 2012 - 12:30 PM, said:

Well, an empty string "" definitely cannot be convert to double so you need to find out why that string is empty.


well it returns a value from the combobox and displays it within the double quotes.
Was This Post Helpful? 0
  • +
  • -

#6 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 01:29 PM

OK, what value is it returning from the combobox? Also, which line is the error being displayed on?

The error is saying the "" (an empty string) is trying to be converted to a numerical type 'Double' in case.

This post has been edited by CharlieMay: 08 October 2012 - 01:33 PM

Was This Post Helpful? 0
  • +
  • -

#7 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 01:40 PM

View PostCharlieMay, on 08 October 2012 - 01:29 PM, said:

OK, what value is it returning from the combobox? Also, which line is the error being displayed on?

The error is saying the "" (an empty string) is trying to be converted to a numerical type 'Double' in case.


this is the line of the error.
sqlComm.Parameters("@Venue_Name").Value = ParameterDirection.Input = ComboBox2.Text


I have populated my combobox from a table in sql 2000. this is supplying me with values of various venues as char.
so when i do choose any one of the values the error is shown on the above line.
Was This Post Helpful? 0
  • +
  • -

#8 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 01:52 PM

OK, I think it's confused with the direction and the combobox

Try:
sqlComm.Parameters.add("@Venue_Name", SqlDbType.Char, 30).Value = ComboBox2.Text
sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input

Was This Post Helpful? 0
  • +
  • -

#9 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 01:53 PM

You have two = in this statement. It compares last two if they are the same, and tries to asign TRUE or FALSE to .Vlaue.

Edit: to clarify a bit, try this in console:
Module Module1

    Sub Main()
        Dim test1 As String = "test1"
        'try changing test2 to "test2" later
        Dim test2 As String = "test1"
        Dim something = test1 = test2

        Console.WriteLine(something)
        Console.ReadLine()
    End Sub

End Module


This post has been edited by lucky3: 08 October 2012 - 01:59 PM

Was This Post Helpful? 1
  • +
  • -

#10 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 01:56 PM

I need the values from that table so I hope that's not my problem. Just for the record, i am new to vb and i have been using youtube videos and readings tutorial on how to code, so please mind my code. I hope its not too bad. :(
Was This Post Helpful? 0
  • +
  • -

#11 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 02:07 PM

Well, you're using Parameters and Stored Procedures for your data access so that is definitely a plus.

On top of what lucky3 described, it went a little further than that because the actual comparison that would have been made with the 2 equals in those lines were creating the error because it was trying to first compare an enum of an integer to a blank string "" and therefore giving you the casting error. Had it been a successful cast, it was still wrong as he pointed out because it would have set the value to either True or False.

If you were to turn on Option Strict in your code, this would have shown an error right off the bat and wound not have even let you run the program.

This post has been edited by CharlieMay: 08 October 2012 - 02:07 PM

Was This Post Helpful? 2
  • +
  • -

#12 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 02:08 PM

View PostCharlieMay, on 08 October 2012 - 01:52 PM, said:

OK, I think it's confused with the direction and the combobox

Try:
sqlComm.Parameters.add("@Venue_Name", SqlDbType.Char, 30).Value = ComboBox2.Text
sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input

That works :D thanks. but i think my stored procedure is wrong.
There are three columns in my table.
Venue_Name, Start_Date, End_Date

i need a procedure to check the venue_name to the start_date and end_date.
How do i go about doing that? any ideas?
Was This Post Helpful? 0
  • +
  • -

#13 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 02:15 PM

So I assume that the code will be like this? As not to confuse vb

qlComm.Parameters.Add("@Venue_Name", SqlDbType.Char, 30).Value = ComboBox2.Text
        sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input
        sqlComm.Parameters.Add("@Start_Date", SqlDbType.NVarChar, 8).Value = DateTimePicker1.Text
        sqlComm.Parameters("@Start_Date").Direction = ParameterDirection.Input
        sqlComm.Parameters.Add("@End_Date", SqlDbType.NVarChar, 8).Value = DateTimePicker2.Text
        sqlComm.Parameters("@End_Date").Direction = ParameterDirection.Input

Was This Post Helpful? 0
  • +
  • -

#14 wanabavbcoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 08-October 12

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 03:21 PM

Sorry to bug your'll again but another error appeared:

An unhandled exception of type 'System.Reflection.AmbiguousMatchException' occurred in microsoft.visualbasic.dll

Additional information: No accessible overloaded 'MessageBox.Show' is most specific for these arguments:
Public Function Show ( ByVal text As String, ByVal caption As String ) As System.Windows.Forms.DialogResult
Public Function Show ( ByVal owner As System.Windows.Forms.IWin32Window, ByVal text As String ) As System.Windows.Forms.DialogResult

this breaks on
 MessageBox.Show(sqlComm.ExecuteScalar, "This works im happy")


Can anyone tell me why?
Was This Post Helpful? 0
  • +
  • -

#15 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: An unhandled exception of type 'System.InvalidCastException' o

Posted 08 October 2012 - 10:44 PM

In short: instead of having sqlComm.ExecuteScalar as Text property for MessageBox.Show method, declare new string variable, and put that in. Like:
Dim myExecuteScalarResult As String = sqlComm.ExecuteScalar
MessageBox.Show(myExecuteScalarResult , "This works im happy")



Why you get this error: AmbigiousMatchException Class on MSDN. Read Remarks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1