|
-
Apr 3rd, 2008, 09:10 AM
#1
Thread Starter
Lively Member
initializing Object
This is Csharp code for initializing the Object
Code:
PPrivew Privew = new PPrivew( "Val1", "Val2", "Val13", "Val13","Val4" );
how can i write this line in VB6 so that it also show me the intellisense like in Csharp
-
Apr 3rd, 2008, 09:22 AM
#2
Re: initializing Object
The following should do the job of Initializing a class object using constructor
Dim Privew As New PPrivew("Val1", "Val2", "Val13", "Val13","Val4" )
-
Apr 3rd, 2008, 09:22 AM
#3
Re: initializing Object
What object are you trying to initialize? Some kind of print preview control?
-
Apr 3rd, 2008, 10:35 AM
#4
Re: initializing Object
this isn't possible in VB6
Dim Privew As New PPrivew("Val1", "Val2", "Val13", "Val13","Val4" )
VB6 doesn't allow for alternate constructors...
you have to do it in multi-steps:
Code:
Dim Privew As PPriview
SET Priview = New PPrivew
Priview.Val1 = ""
.
.
.
-tg
-
Apr 3rd, 2008, 12:37 PM
#5
Thread Starter
Lively Member
Re: initializing Object
Yes its a print preview control
techgnome that will not work
you are setting val1 as a property
val1 is a argument
and that code shows error message that "invalid use of new keyword"
-
Apr 3rd, 2008, 12:38 PM
#6
Re: initializing Object
And where did you get this control?
-
Apr 3rd, 2008, 12:40 PM
#7
Thread Starter
Lively Member
Re: initializing Object
"Some kind of print preview control?"
"And where did you get this control?"
is that really matters?
-
Apr 3rd, 2008, 11:21 PM
#8
Thread Starter
Lively Member
Re: initializing Object
code converstion tools suggest this format
Dim Privew As New PPrivew("Val1", "Val2", "Val13", "Val13","Val4" )
but this is wrong
plz help
-
Apr 4th, 2008, 02:45 AM
#9
Addicted Member
Re: initializing Object
i dont think constructors exists in vb6, you have to find some alternative way to initialize your object.
-
Apr 4th, 2008, 07:31 AM
#10
Re: initializing Object
 Originally Posted by xor83
Yes its a print preview control
techgnome that will not work
you are setting val1 as a property
val1 is a argument
I *know* that.... but you *CAN'T* use parameterized constructors in VB6. Simple as that. So that means you have to new-up the object first, THEN set the parameters, hopefully the parameters are exposed through properties of some kind.
and that code shows error message that "invalid use of new keyword"
That actually then answers the next question I had, which was if the object has a parameterless constructor. It does not. That essentially renders the object useless in VB6.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|