I'm running a VB6 project, and when I try to use the standard declaration of
a New DataObject:
Dim data_object As New DataObject
I get the error "Invalid use of New keyword". The environment is perfectly
happy to let me declare the variable without the word "New", but then I get
the error that the variable isn't set when I try to use it later on. Or I can
declare the variable without New and then try to set it to New DataObject,
but then I again get the "Invalid use of New keyword" error.
I saw another post on this forum where someone got this error and was told
not to use a Type statement with it. I am doing no such thing. In fact, I can
start a new VB project and type
dim Var as
and it will help me fill in DataObject after "as". But when I do the same
thing after "New" there's no "DataObject" item in the popup list for me to
choose.
If I need to include something, or set a reference, please let me know what
that is.
Thanks!
> I'm running a VB6 project, and when I try to use the standard declaration of
> a New DataObject:
>
> Dim data_object As New DataObject
>
> I get the error "Invalid use of New keyword". The environment is perfectly
> happy to let me declare the variable without the word "New", but then I get
> the error that the variable isn't set when I try to use it later on. Or I can
> declare the variable without New and then try to set it to New DataObject,
> but then I again get the "Invalid use of New keyword" error.
The same thing would happen if you tried to use Textbox.
VB has its own DataObject, so that word is reserved. Use a different
name for your object. (See OLEDragDrop event parameters for example)
LFS