Results 1 to 26 of 26

Thread: System.InvalidOperationException in Application designer.vb

Threaded View

  1. #21

    Thread Starter
    Addicted Member
    Join Date
    Dec 2015
    Location
    Hastings, UK
    Posts
    137

    Re: System.InvalidOperationException in Application designer.vb

    Forget about #19, I must have posted at the same time as #18!

    The ValueChanged event handler was created when I double clicked on the control.
    So, if I'm correct the form is a Module, therefore any variables I declare in that module will be available to any of the sub-routines.
    How does it change if in a ValueChanged event?
    Could you give me an example?
    Assuming that the way I have written these subs is correct, then:
    I have 2 NUD controls and have changed one like so:
    Code:
     Private Sub nudFSize_ValueChanged(sender As Object, e As EventArgs) Handles nudFSize.ValueChanged
            Dim Fsize As Integer = CInt(nudFSize.Value)
            MessageBox.Show(CStr(FSize))
        End Sub
    The other NUD is similar, but says that nudTop has not been declared??
    Code:
    Private Sub nudTop_ValueChanged(sender As Object, e As EventArgs) 
            Dim CTop As Integer = CInt(nudTop.value)
        End Sub
    Why does the nudTop have the Handles part?
    Why does the FSize one not show the same error?
    I did try as InteliSense suggested, but that still said that nudTop had been used before it had been assigned a value?
    Code:
    Dim nudTop As NumericUpDown = nudTop
    Last edited by Rocky48; Jun 16th, 2019 at 12:21 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width