|
-
Apr 30th, 2008, 04:25 PM
#1
Thread Starter
PowerPoster
[RESOLVED] some questions
i'm using visual basic 6 and i have some questions that i need some help:
-why, when, we use class variables or same objects variables we must use NEW(for declare) and SET(for change the value), but in normal variables we don't need use these keywords?
-draw an image is the same: design an image?
-what is the meaning of DOEVENTS keyword?
thanks
-
Apr 30th, 2008, 04:34 PM
#2
Re: some questions
1. In VB6 not every type is an object so those that are not don't need to be instantiated and object variable must be - therefore using the New keyword in most cases is a must.
2. Image file and image property of the Form or Picturebox objects are not the same:
Form.Print, Form.PaintPicture, Form.Line metods will create an image on the form (same goes for Picturebox).
3. DoEvents is normally used inside loops - it passes control to operating system so your program is not locked and will allow to execute other events.
It however comes with the price - DoEvents is cpu hungry.
-
Apr 30th, 2008, 04:41 PM
#3
Thread Starter
PowerPoster
Re: some questions
"1. In VB6 not every type is an object so those that are not don't need to be instantiated and object variable must be - therefore using the New keyword in most cases is a must."
i'm sorry, i'm protuguese, but these hansher(is right write?) is confuse to me.
why using in some cases NEW and SET keywords?
-
Apr 30th, 2008, 05:32 PM
#4
Re: some questions
The easiest thing to say about New and Set is "that's the way VB works", but let me try to say what Rhino said in a different way.
In VB6 you have variables and objects. When you use an object it is required that you bring a new one (a new instance) into existence before it can be used. This is called instantiating the object and you use the New keyword to do that. And as for using Set, well, that's just the way it is.
BTW it's "answer" rather than "hanser".
-
Apr 30th, 2008, 05:33 PM
#5
Re: some questions
The alternative to Set is Let, but you don't actually need to write it (and most people don't), eg:
Code:
Dim x as Integer
Let x = 1 'these two lines do the same thing
x = 1
Both Set and Let say to assign a value to the variable. There are two different words, as the way an object is stored is different to the way normal values are stored (so the work needed is different).
You use the New keyword to create an instance of a class, rather than connecting to an instance that already exists.
-
Apr 30th, 2008, 06:10 PM
#6
Thread Starter
PowerPoster
Re: some questions
thanks to everyone. thanks
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
|