dll error: Expression is not a method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Neuro
    New Member
    • Mar 2010
    • 4

    dll error: Expression is not a method

    Ok so I have alot of plans for programs coming up and I want them all to fade in and out so instead of copy and pasting from project to project etc I learnt about dll's

    So when I added in the references etc and I typed in what I declared the Fadein function as which was "FadeIn" I got an error saying it needed to be declared
    So I declared it as a string
    Code:
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim FadeIn As String
            FadeIn(Me)
        End Sub
    Then I get a different error saying Expression is not a method.

    Argghh! What do I do?
    Last edited by tlhintoq; Mar 4 '10, 05:20 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      Before worrying about this in a DLL, does your method call work if your method is in the application?

      What I'm saying is, test it within the project - within the application itself - and work out all the bugs before you transplant it into a DLL

      Code:
       Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
              Dim FadeIn As String
              FadeIn(Me)
          End Sub
      Right. FadeIn isn't a method so you can't call it like a method with FadIn(Me)
      You just declared FadeIn as a string.

      Go back to the original call/error. FadeIn is not declared. Did you declare a method within your application that imports the DLL method of FadeIn ?

      Comment

      • Neuro
        New Member
        • Mar 2010
        • 4

        #4
        I don't get you and it is tested I got the fade code off a video it definetly works and I don't get strings I just put that to get rid of error and what do you mean did I declare a method??

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          Oh where do I begin?

          I don't get strings
          Do you mean you don't understand what strings are? You are declaring that FadIn is a string
          Code:
          Dim FadeIn As String
          Then you try to call it like it were a method
          Code:
          FadeIn(Me)
          Hence you get an error saying that FadeIn is not a method to be called.


          and what do you mean did I declare a method??
          Ok, you have FadeIn() as a method inside your DLL. How does your application know about it? Where did you tell your program that your use of FadeIn should call the DLL method?

          Comment

          • Neuro
            New Member
            • Mar 2010
            • 4

            #6
            So how do I fix it?
            the dll code is:

            Code:
            Imports System.Windows.Forms
            
            Public Class Class1
                Public Sub FadeIn(ByVal Target As Form)
                    Dim i As Double = 0.0
                    Target.Opacity = 0.0
                    For i = 0.0 To 100.0 Step 0.001
                        Target.Opacity = i
                        Application.DoEvents()
                    Next
                End Sub
                Public Sub Fadeout(ByVal Target As Form)
                    Dim i As Double = 100.0
                    Target.Opacity = 100.0
                    For i = 100.0 To 0.0 Step 0.001
                        Target.Opacity = i
                        Application.DoEvents()
                    Next
                End Sub
            End Class
            Last edited by tlhintoq; Mar 4 '10, 07:02 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              I got the fade code off a video
              So how do I fix it?
              You start slower and first learn the basics. You need to be able to first write a working self-contained application from your own code - before - you jump in and try to deal with DLL's.

              I don't want to be discouraging, but right now you are having trouble distinguishing a variable from a method, or understanding the error message so you can fix your own very basic problems. Compounding your situation with more advanced concepts like calling DLL's is just going to make you further frustrated and in the long run make coding a less enjoyable endeavor.

              Accept that you need to walk before you can run.

              TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

              Comment

              • Neuro
                New Member
                • Mar 2010
                • 4

                #8
                ~You weren't helpful and you were discouraging both of you. There is better resources out there with alot more people on who are actually helpful so to be honest. F***off
                Last edited by tlhintoq; Mar 4 '10, 10:25 PM. Reason: cursing edited

                Comment

                • tlhintoq
                  Recognized Expert Specialist
                  • Mar 2008
                  • 3532

                  #9
                  "both of you"

                  both... who? I'm the only person to respond to your question. I'm sorry if not doing your homework for you - but instead suggesting you *learn* to code rather than copy/paste other people's work is what you call discouraging.

                  Perhaps coding is not the field for you.

                  Respect is earned, not a birthright right. I hope that you use and enjoy the site. There are a great many talented people here that are willing to assist those that take coding seriously. I ask only that you treat the volunteers here with a level of professionalism that they have earned through years of being paid for their craft. The people you are addressing here have risen to the top of their field and have taken it upon themselves to give back to the coding community by volunteering their time as mentors.

                  Comment

                  Working...