CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 1999
    Location
    Baytown, TX, United States
    Posts
    23

    compile error: method or data member not found

    I have the following code:
    [vbcode]Private Sub cmdCalc_Click()
    'calculate value of paperbacks
    lblVp.Caption = Val(txtCpaper.Text)* Val(txtNpaper.Text)
    [vbcode]

    I run it and get the following message:

    compile error: method or data member not found




  2. #2
    Join Date
    May 1999
    Posts
    14

    Re: compile error: method or data member not found

    Make sure that you still have a button named cmdCalc, a label named lblVp and two text boxes named txtCpaper and txtNpaper. Also check your spelling.

    It may sound stupid, but it's easy to make this mistake...

    That error message is telling you that you don't have an object by one of those names or one of those objects don't have a method that you are trying to use...


  3. #3
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: compile error: method or data member not found

    Use Str for better Format fns to format the value into a string before assigning to Caption.
    lblVp.Caption = Format(Val(txtCpaper.Text)* Val(txtNpaper.Text),"####.##")


    RK

  4. #4
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: compile error: method or data member not found

    Try to change the last row in your code to this one:

    lblVp.Caption = cstr(Val(txtCpaper.Text)* Val(txtNpaper.Text))



    Did it work???

    Michael Vlastos
    Automation Engineer
    Company Modus SA
    Development Department

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

Featured