What Does VS Know and When Does It Know It?

  • Thread starter Thread starter eBob.com
  • Start date Start date
E

eBob.com

If I type "objSheet." ("Dim objSheet As Excel._Worksheet") VS gives me a
list of everything which can follow the period. Or so I have always
thought. But recently I've needed the Pictures method and it is not in the
list. The list is alphabetic and goes ..., Paste, PasteSpecial,
PivotTables, and PivotTableWizard, ... no Pictures.

But if I persist and type in the following code, ...

objSheet.Range("a1").Select()
objSheet.Pictures.insert("c:a.jpg")

.... there's no indication of an error after I type those statements AND I
get no Build errors AND it executes without an error.

So know I am confused about the list which VS presents to me after I have
typed the name of an instance. I'm obviously not getting a list of
everything that's valid. So what is this list?

Unfortunately I've learned VS entirely on my own. So this is probably at
good time to ask if there is a good introductory book or article.

Thanks, Bob
 
ebob,

Did you see a little tab under the list, what does it say?
If you select All you get all.

Cor
 
ebob,

Did you see a little tab under the list, what does it say?
If you select All you get all.

Cor

Actually, I don't think Intellisense will list all of the Office
interop commands - whether you use the "All" tab or the "Common" tab.
I think this is an Office problem and not strictly a problem with the
VS IDE as my Visual Basic 6 Pro edition also does not display the
Range item in the Intellisense popup.

Thanks,

Seth Rowe
 
rowe_newsgroups said:
Actually, I don't think Intellisense will list all of the Office
interop commands - whether you use the "All" tab or the "Common" tab.
I think this is an Office problem and not strictly a problem with the
VS IDE as my Visual Basic 6 Pro edition also does not display the
Range item in the Intellisense popup.

Thank you Seth. I don't see an "All" or "Common" tab. I use MsDE 2003 V
7.13088 and .NET Framework V1.1.4322 SP1.

The curious thing is that Pictures is not in the list, but is not identified
as an error (no squiggly line) when I go ahead and use the method. Is that
because Intellisense provides the list but some other piece of code is
checking statements for validity?

Thanks, Bob
 
If something uses a particular type then the type is known at compile time
and VS can suggest all its members.

If something uses the "Object" type then the type is not known at compile
time and VS can't suggest anything particular.

For example WorkSheets.Item return an object, not a worksheet so VS.NET
won't suggest anything...

In this particular case, if you use the Office object browser you'll see
that pictures is an hidden method....
 
Back
Top