|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why am I getting Method or data member not found?Load IC74xx259(IC74xx259.Ubound + 1) With IC74xx259(IC74xx259.Ubound) .Visible = True .CurrentX = 35 .CurrentY = 15 IC74xx259(.Index).Print "IC" & .Index End With Here's the code that generates a Compile Error, Method or data member not found: Load IC74xx259(IC74xx259.Ubound + 1) With IC74xx259(IC74xx259.Ubound) .Visible = True .CurrentX = 35 .CurrentY = 15 .Print "IC" & .Index End With Why does it barf over the .Print if the abbreviated dot notation is used? MM "MM" <kylix***@yahoo.co.uk> wrote in message Because it's VB. You simply MUST use Printer.Print. Nothing but a quirk.news:inf4s4lcp2ispdf34hicj7rl7og51ibpkd@4ax.com... > Why does it barf over the .Print if the abbreviated dot notation is > used? "MM" <kylix***@yahoo.co.uk> wrote in message I'm afraid that's just the way it is. There are various things that cannot news:inf4s4lcp2ispdf34hicj7rl7og51ibpkd@4ax.com... > Here's the code that generates a Compile Error, > Method or data member not found: > Load IC74xx259(IC74xx259.Ubound + 1) > With IC74xx259(IC74xx259.Ubound) > .Visible = True > .CurrentX = 35 > .CurrentY = 15 > .Print "IC" & .Index > End With > Why does it barf over the .Print be used in the normal way in a With End With construct. Print is one of them, regardless of the object on which you are using it. Most methods also fail under such circumstances, such as Circle and Line and PSet and others. For such things you need to fully qualify the object. I seem to remember once reading a help file which suggested that methods (as opposed to properties) could not be used in that manner, although in the current help files it does not say that, at least in the files I've got. You can of course use something other than a With End With construct, perhaps a Function instead and pass the object to it, but if you want to use With End With then I'm afraid you've just got to live with its limitations. Mike
Show quote
Hide quote
"MM" <kylix***@yahoo.co.uk> wrote in message Look in the object viewer or the intellisense list that pops up when you news:inf4s4lcp2ispdf34hicj7rl7og51ibpkd@4ax.com... > Here's the code that works: > > Load IC74xx259(IC74xx259.Ubound + 1) > With IC74xx259(IC74xx259.Ubound) > .Visible = True > .CurrentX = 35 > .CurrentY = 15 > IC74xx259(.Index).Print "IC" & .Index > End With > > > Here's the code that generates a Compile Error, Method or data member > not found: > > Load IC74xx259(IC74xx259.Ubound + 1) > With IC74xx259(IC74xx259.Ubound) > .Visible = True > .CurrentX = 35 > .CurrentY = 15 > .Print "IC" & .Index > End With > > Why does it barf over the .Print if the abbreviated dot notation is > used? type the '.' -- Print is not a method of the object that the With variable references. The VB compiler is handling Print as a special case and it's a limitation (or a bug depending on how you look at it) that it can't figure it out inside the With block. This special handling came in with VB4 and back then MS was still concerned enough about people being able to move code forward that they went the extra mile to implement the drawing methods in such a way that it would have minimal effect on existing code. Now, of course, anything that doesn't fit cleanly in the latest paradigm is considered anathema and anybody using it is ridiculed. Not that I harbor any anger or anything... <g>
Rubberband Line with ScrollBar
Active X and Vista Why there is a limit of 65,536 bytes when writing to file? Value > Long Data Type How to make this call from form to control Differences between VB amd VBA and VBA Education Application.Quit but Word remains open in Task Manager VB App fails when log reaches 65536 Knowing what launched an EXE that used CreateProcess()? NET Required ??? |
|||||||||||||||||||||||