Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Using Functions across forms

Using Functions across forms

Scheduled Pinned Locked Moved Visual Basic
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gwittlock
    wrote on last edited by
    #1

    Here is my scenario I have a Main Form and that form has 3 Menus for each menu item I have a dialogbox (another form really) in the main form I have the following sub 'To be called by a docking form (during its activation). Public Sub SetCurrentDialog(dlg As Form) m_curr_dlg = dlg End Sub for each of the menus I have the following Private Sub Menu1_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu1.ItemClick SetCurrentDialog(Dilaog1) Dialog1.ShowDialog(Me) End Sub Private Sub Menu2_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu2.ItemClick SetCurrentDialog(Dilaog2) Dialog2.ShowDialog(Me) End Sub Private Sub Menu3_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu3.ItemClick SetCurrentDialog(Dilaog3) Dialog3.ShowDialog(Me) End Sub in each of the Dialogs I have a Public Function as Public Function ClientMouseUp() 'Do special MouseUp End Function on the MianForm I also have a PicturBox which I want to return information to the dialog so I have Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp m_curr_dlg.ClientMouseUp() End Sub But in the PictureBox1_MouseUp I get the following error Error 39 'ClientMouseUp' is not a member of 'System.Windows.Forms.Form'. Can anyone show me the errors of my ways?

    P B 2 Replies Last reply
    0
    • G gwittlock

      Here is my scenario I have a Main Form and that form has 3 Menus for each menu item I have a dialogbox (another form really) in the main form I have the following sub 'To be called by a docking form (during its activation). Public Sub SetCurrentDialog(dlg As Form) m_curr_dlg = dlg End Sub for each of the menus I have the following Private Sub Menu1_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu1.ItemClick SetCurrentDialog(Dilaog1) Dialog1.ShowDialog(Me) End Sub Private Sub Menu2_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu2.ItemClick SetCurrentDialog(Dilaog2) Dialog2.ShowDialog(Me) End Sub Private Sub Menu3_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu3.ItemClick SetCurrentDialog(Dilaog3) Dialog3.ShowDialog(Me) End Sub in each of the Dialogs I have a Public Function as Public Function ClientMouseUp() 'Do special MouseUp End Function on the MianForm I also have a PicturBox which I want to return information to the dialog so I have Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp m_curr_dlg.ClientMouseUp() End Sub But in the PictureBox1_MouseUp I get the following error Error 39 'ClientMouseUp' is not a member of 'System.Windows.Forms.Form'. Can anyone show me the errors of my ways?

      P Offline
      P Offline
      Peter Leow
      wrote on last edited by
      #2

      typo?

      SetCurrentDialog(Dilaog1)

      or

      SetCurrentDialog(Dialog1)

      G 1 Reply Last reply
      0
      • P Peter Leow

        typo?

        SetCurrentDialog(Dilaog1)

        or

        SetCurrentDialog(Dialog1)

        G Offline
        G Offline
        gwittlock
        wrote on last edited by
        #3

        Yep it was a typo

        1 Reply Last reply
        0
        • G gwittlock

          Here is my scenario I have a Main Form and that form has 3 Menus for each menu item I have a dialogbox (another form really) in the main form I have the following sub 'To be called by a docking form (during its activation). Public Sub SetCurrentDialog(dlg As Form) m_curr_dlg = dlg End Sub for each of the menus I have the following Private Sub Menu1_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu1.ItemClick SetCurrentDialog(Dilaog1) Dialog1.ShowDialog(Me) End Sub Private Sub Menu2_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu2.ItemClick SetCurrentDialog(Dilaog2) Dialog2.ShowDialog(Me) End Sub Private Sub Menu3_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Menu3.ItemClick SetCurrentDialog(Dilaog3) Dialog3.ShowDialog(Me) End Sub in each of the Dialogs I have a Public Function as Public Function ClientMouseUp() 'Do special MouseUp End Function on the MianForm I also have a PicturBox which I want to return information to the dialog so I have Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp m_curr_dlg.ClientMouseUp() End Sub But in the PictureBox1_MouseUp I get the following error Error 39 'ClientMouseUp' is not a member of 'System.Windows.Forms.Form'. Can anyone show me the errors of my ways?

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #4

          You need an Interface with the function ClientMouseUp, and all of your dialogs need to implement it.

          G 1 Reply Last reply
          0
          • B Bernhard Hiller

            You need an Interface with the function ClientMouseUp, and all of your dialogs need to implement it.

            G Offline
            G Offline
            gwittlock
            wrote on last edited by
            #5

            I do not understand what you mean by interface. I am trying to convert old VB6 code, which is why I am having the issue. I am new to VB.net. I am sorry in advance if I am asking a stupid question

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups