none
Expression does not produce a value. and Comma, ')', or a valid expression continuation expected. RRS feed

  • Question

  • i need help her is my code

    Public Class Forma
        Private printForm As Object
        Private Sub ProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ProjectToolStripMenuItem.Click
            If ProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Then Form_load(FormB As Object)
            Me.printForm.Print
        End Sub
        Private Sub Form_load(FormB As Object)
            Me.printForm = FormB
        End Sub
    
    
    End Class
    but now i'm getting bc30491 Expression does not produce a value. and bc32017 Comma, ')', or a valid expression continuation expected. what do i do?

    Friday, October 20, 2017 2:24 PM

All replies

  • i need help her is my code

    Public Class Forma
        Private printForm As Object
        Private Sub ProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ProjectToolStripMenuItem.Click
            If ProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Then Form_load(FormB As Object)
            Me.printForm.Print
        End Sub
        Private Sub Form_load(FormB As Object)
            Me.printForm = FormB
        End Sub
    
    
    End Class
    but now i'm getting bc30491 Expression does not produce a value. and bc32017 Comma, ')', or a valid expression continuation expected. what do i do?

    Hi

    Maybe this?

        Private Sub ProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ProjectToolStripMenuItem.Click
            Dim frm As New FormB
            frm.Show()
        End Sub


    Regards Les, Livingston, Scotland

    Friday, October 20, 2017 2:41 PM
  • but now i'm getting bc30491 Expression does not produce a value. and bc32017 Comma, ')', or a valid expression continuation expected. what do i do?

    'ProjectToolStripMenuItem_Click(sender As Object, e As EventArgs)' is a sub, and does not return a value. You can't use it as a value in an expression such as an 'IF' statement. You should describe what you want to test in that expression to determine whether or not Form_Load gets executed.

    Friday, October 20, 2017 8:17 PM