5 Replies - 5928 Views - Last Post: 11 December 2009 - 02:00 PM Rate Topic: -----

#1 codeye  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-December 09

compiler error "method or data member not found" help please

Post icon  Posted 10 December 2009 - 04:10 AM

hi everyone! am new to VB and this forum. i have an assignment to develop a simple program that grades marks using "if..else" statement, wen i run the program i keep getting this error message: "compiler erro method or data member not found" with the highlight on the "text" on the code.(as shown) please help me. thank you.

	 Private Sub cmdGrade_Click()

If txt1.Text  < 0 Then
lb1.Caption = "Error"
ElseIf txt1.Text < 41 Then
lb1.Caption = "D"
ElseIf txt1.Text < 50 Then
lb1.Caption = "C"
ElseIf txt1.Text < 60 Then
lb1.Caption = "B"
ElseIf txt1.Text < 70 Then
lb1.Caption = "B+"
ElseIf txt1.Text < 100 Then
lb1.Caption = "A"
Else: lb1.Caption = "Error"
End If



This post has been edited by codeye: 10 December 2009 - 04:34 AM


Is This A Good Question/Topic? 0
  • +

Replies To: compiler error "method or data member not found" help please

#2 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: compiler error "method or data member not found" help please

Posted 10 December 2009 - 07:02 AM

are you sure you renamed the text box control that is by default Text1 to txt1? Also, a little error checking within that elseif structure would be to check for trim(text1.text)=vbnullstring to make sure that there is data contained within the text box. Also, to evaluate a string against a number, you should use val(text1.text) (your operator of comparison or mathmatical calculation) number.



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

#3 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: compiler error "method or data member not found" help please

Posted 11 December 2009 - 03:31 AM

where is

end sub
Was This Post Helpful? 0
  • +
  • -

#4 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

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

Re: compiler error "method or data member not found" help please

Posted 11 December 2009 - 03:56 AM

what part is highlighted we can see it like you do on the compiler can you pls show us the row where the error show up :)
Was This Post Helpful? 0
  • +
  • -

#5 kirton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 02-January 09

Re: compiler error "method or data member not found" help please

Posted 11 December 2009 - 08:40 AM

2 things
1 where is end sub .. but this would create different error
2 make sure you are using LBL not LB1 I wrote them in caps to see the difference. I run this and it seems like LB1.
Was This Post Helpful? 0
  • +
  • -

#6 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

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

Re: compiler error "method or data member not found" help please

Posted 11 December 2009 - 02:00 PM

any way see this
http://msdn.microsof...y/s6k83xsh.aspx
in this code you give us the problems may be :

you misspell text box or label as kirton say it is probably lb1.Caption the proble it is lbl1.Caption. but this user probably solve the problem :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1