We help IT Professionals succeed at work.

Reference to a non-shared member requires an object reference

761 Views
Last Modified: 2012-05-05
Good Evening

Experts:

I have a bit of a problem here.  Working with VB.net as an AddOn in SAP Business One.  
The problem is related to the .Net so no worries about needing SAP knowledge. I have a Class that calls another Class if the User executes a button click on the calling form.  When leaving the called form I want to refresh the calling form but I am getting an error which I really don't understand.  To refresh I have a subroutine in the calling form called FillBOMTab.  
Public Class ItemTypeMaint
        Public Sub FillBOMTab(ByVal ItNum As String)
        .....
         Dim ItemTypeROUTINGForm As New LBSI_ItemTypeROUTING(ItemNum, SelectedRoutingRowCode, Mode)
         .....
End Class

From the called form I attempt to reference FillBOMTab be qualifying it with the Project and called form reference --> Enhance.ItemTypeMaint.FillBOMTab(RoutingItemNumPassed). However, I am getting the following error:

Reference to a non-shared member requires an object reference.  How do I do that?

Not sure if this is enough info to explain my problem.  So, feel free to ask questions.

Thanks for the help,
jimbo99999
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
"I have a Class that calls another Class if the User executes a button click on the calling form.  When leaving the called form I want to refresh the calling form but I am getting an error..."

The easiest way to do this is to show the "called" form MODALLY using ShowDialog() instead of Show().  This prevents the user from using the "caller" until the "callee" is closed.  The code in the "callee" is HALTED until the "called" form is closed:

Public Class ItemTypeMaint

        Public Sub Button1_Click(...) Handles Button1.Click
            Dim frm As New YourCalledFormHere
            ' initialize "frm" somehow...

            frm.ShowDialog() '  <-- code STOPS here in "ItemTypeMaint" until "frm" is closed
           
            ' now refresh this form by calling FillBOMTab()...I assume you need to pass it some value from "frm"?
            FillBOMTab(frm.SomeRetrievedValue)
        End Sub

End Class

Author

Commented:
Arthur Wood:
Thanks for the help.  It is working now.  I apologize for the tardiness in awarding points...

Have a good day,
jimbo99999
Gald to be of assistance.

AW

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.