Error Method

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 1441 Views - Last Post: 17 October 2010 - 09:47 AM Rate Topic: -----

#1 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Error Method

Posted 15 October 2010 - 12:17 PM

Copiler my code and error appeared, date or method of non-existent.

lblHappy.Caption = "Text"


Accessing the caption label, using code is not so?
Is This A Good Question/Topic? 0
  • +

Replies To: Error Method

#2 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 817
  • Joined: 16-September 09

Re: Error Method

Posted 15 October 2010 - 12:26 PM

View PostApprentice123, on 15 October 2010 - 01:17 PM, said:

Copiler my code and error appeared, date or method of non-existent.

lblHappy.Caption = "Text"


Accessing the caption label, using code is not so?


My experience with compiler errors means something else in your program is wrong and it's just erroring out here...

My obvious question is; Is lblHappy part of the form that this module is written in? If so try this

Me.lblHappy.Caption = "Text"



If that doesn't work, post some more of your code before and after this piece and I'll see if I can't help a bit :)
Was This Post Helpful? 0
  • +
  • -

#3 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Error Method

Posted 15 October 2010 - 12:28 PM

are you using vb2010 ?
Was This Post Helpful? 0
  • +
  • -

#4 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Re: Error Method

Posted 15 October 2010 - 01:08 PM

View Postguyfromri, on 15 October 2010 - 11:26 AM, said:

View PostApprentice123, on 15 October 2010 - 01:17 PM, said:

Copiler my code and error appeared, date or method of non-existent.

lblHappy.Caption = "Text"


Accessing the caption label, using code is not so?


My experience with compiler errors means something else in your program is wrong and it's just erroring out here...

My obvious question is; Is lblHappy part of the form that this module is written in? If so try this



Me.lblHappy.Caption = "Text"



If that doesn't work, post some more of your code before and after this piece and I'll see if I can't help a bit :)


I am using VB 6
I did not understand what you said, my code looks like:
Private Sub Command1_Click()

End Sub

Private Sub Option1_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub Image1_Click()

End Sub

Private Sub cmdExit_Click()
    End
End Sub

Private Sub optHappy_Click()
    picHappy.Visible = True
    picOK.Visible = False
    picSad.Visible = False
    lblHappy.Caption = "I'm going to DisneyWorld!"
    lblOK.Caption = Empty
    lblSad.Caption = Empty
End Sub

Private Sub optOK_Click()
    picHappy.Visible = False
    picOK.Visible = True
    picSad.Visible = False
    lblHappy.Caption = Empty
    lblOK.Caption = "I'm OK today"
    lblSad.Caption = Empty
End Sub

Private Sub optSad_Click()
    picHappy.Visible = False
    picOK.Visible = False
    picSad.Visible = True
    lblHappy.Caption = Empty
    lblOK.Caption = Empty
    lblSad.Caption = "Goodbye, cruel world..."
End Sub

Private Sub picOK_Click()

End Sub


Was This Post Helpful? 0
  • +
  • -

#5 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 817
  • Joined: 16-September 09

Re: Error Method

Posted 15 October 2010 - 01:51 PM

Do optOK and optSad work?
Was This Post Helpful? 0
  • +
  • -

#6 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Re: Error Method

Posted 15 October 2010 - 02:28 PM

View Postguyfromri, on 15 October 2010 - 12:51 PM, said:

Do optOK and optSad work?


I think so, the error is when I use caption on: lblHappy, lblOK and lblSad
Was This Post Helpful? 0
  • +
  • -

#7 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 817
  • Joined: 16-September 09

Re: Error Method

Posted 15 October 2010 - 02:35 PM

So if you were to trigger optSad, you would get the same compile error but with in that sub?

This post has been edited by guyfromri: 15 October 2010 - 02:35 PM

Was This Post Helpful? 0
  • +
  • -

#8 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Re: Error Method

Posted 15 October 2010 - 02:53 PM

View Postguyfromri, on 15 October 2010 - 01:35 PM, said:

So if you were to trigger optSad, you would get the same compile error but with in that sub?


The program is to click on one of three buttons:
I'm Happy!
I'm OK
I'm Sad

Clicking a button should appear in the image and text of the button.
Only, when I click the button the following error appears:
Method or data member not found

Was This Post Helpful? 0
  • +
  • -

#9 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 107
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Error Method

Posted 15 October 2010 - 03:20 PM

I think that the problem is with this:
lblSad.Caption = Empty


What is Empty? I don't think that is a valid statement in VB6. Try changing all of your Empty statements to something like this:
lblSad.Caption = ""

or

lblSad.Caption = vbNullString
Was This Post Helpful? 1
  • +
  • -

#10 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Re: Error Method

Posted 15 October 2010 - 04:17 PM

View PostkeakTheGEEK, on 15 October 2010 - 02:20 PM, said:

I think that the problem is with this:
lblSad.Caption = Empty


What is Empty? I don't think that is a valid statement in VB6. Try changing all of your Empty statements to something like this:
lblSad.Caption = ""

or

lblSad.Caption = vbNullString


It did not work
Was This Post Helpful? 0
  • +
  • -

#11 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 107
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Error Method

Posted 15 October 2010 - 04:50 PM

Was worth a try. In any case, you will need to change all your of the caption properties that you are setting to Empty. That will definitely cause an error. Make sure that they all are changed like so:

Quote

Private Sub optHappy_Click()

picHappy.Visible = True

picOK.Visible = False

picSad.Visible = False

lblHappy.Caption = "I'm going to DisneyWorld!"

lblOK.Caption = ""

lblSad.Caption = ""

End Sub



Private Sub optOK_Click()

picHappy.Visible = False

picOK.Visible = True

picSad.Visible = False

lblHappy.Caption = ""

lblOK.Caption = "I'm OK today"

lblSad.Caption = ""

End Sub



Private Sub optSad_Click()

picHappy.Visible = False

picOK.Visible = False

picSad.Visible = True

lblHappy.Caption = ""

lblOK.Caption = ""

lblSad.Caption = "Goodbye, cruel world..."

End Sub


Since everything we have tried to help hasn't worked, you are going to have to do a little more debugging to isolate the problem. I would set a break point at the first line in each of your sub routines. Then run your code and when you hit the break point, step through each line of code until you come to the line of code that causes the error. That way you will know exactly where in your program the error is occurring.

Good Luck!
Was This Post Helpful? 0
  • +
  • -

#12 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 817
  • Joined: 16-September 09

Re: Error Method

Posted 15 October 2010 - 08:15 PM

View PostkeakTheGEEK, on 15 October 2010 - 04:20 PM, said:

I think that the problem is with this:
lblSad.Caption = Empty


What is Empty? I don't think that is a valid statement in VB6. Try changing all of your Empty statements to something like this:
lblSad.Caption = ""

or

lblSad.Caption = vbNullString

Lol...i got so into looking for something more intricate, I didn't even notice that! (((Shamed))) -- Nice!
Was This Post Helpful? 0
  • +
  • -

#13 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,771
  • Joined: 26-March 09

Re: Error Method

Posted 16 October 2010 - 01:10 AM

OK, It's early morning and I'm half asleep, so forgive me if I've misread this.

Back to basics....

1. If you select "Start with full compile" or shift-F5, does the program fully compile? From what you have written, it sounds like you just press the start button.
2. Have you actually got controls on your form called lblHappy etc., and are they actually labels?

Sorry if I'm stating the obvious.
Was This Post Helpful? 1
  • +
  • -

#14 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Error Method

Posted 16 October 2010 - 07:32 AM

this error show up if the label dose not exist or the property dose not exist. since your using VB6 my guess is you have some typo somewhere and the lblHappy dose not exist. That is why my question was do you use vb.net in vb.net labels caption property is changed to text property so check for the spelling of your labels :)
Was This Post Helpful? 0
  • +
  • -

#15 Apprentice123  Icon User is offline

  • D.I.C Regular

Reputation: -16
  • View blog
  • Posts: 265
  • Joined: 30-June 08

Re: Error Method

Posted 16 October 2010 - 08:06 AM

View PostNoBrain, on 16 October 2010 - 06:32 AM, said:

this error show up if the label dose not exist or the property dose not exist. since your using VB6 my guess is you have some typo somewhere and the lblHappy dose not exist. That is why my question was do you use vb.net in vb.net labels caption property is changed to text property so check for the spelling of your labels :)


I am using Microsoft Visual Basic 6.0

I think that VB is not recognizing the Caption, because when type lblHappy. appears the following options in VB:
Count
Item
LBound 
UBound


Not appears the Caption

I've tried to replace all Empty to "" and not work.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2