Dear Friends
i want to know in VB6 what is forms is that classes or objects, since we can have

dim a as new form1


and also please extend same for other controls

Recommended Answers

All 6 Replies

form is an object. To study more about it, plz refer VB book of Wrox & Orelly Publication.

In vb6 the form is treated like an object. But if you use the .net platform of vb then this becomes a standalone class. when we refer dim a as new form1, means we actually create a new object of the class form1 and simultaneously allocating memory to it. if wish to know more just visit and search form windows forms in visual basic. you will find enourmous totorials,resources and articles there.

Always remember that the best alternative is to learn anything from the organization who has developed it.

Member Avatar

You want to know what is a form right????
A form is basically a container control,
container control means an object which can hold
one or more controls like buttons
check boxeses etc...
some thing you may need..............

private sub form_load()
end sub

the above sub procedure is automatically called when form is loaded.
form is loaded means it now exists in memory
it has no relation with its visibility

<formname>.show 'displays the form(even the form is not loaded)
<formname>.hide 'hides the form(even the form is not loaded)

unload <formname> unloads the form from memory.............

I think you don't feel it boring..........

Don't compare vb 6.0 with its successors .

VB6 was apparently the last of the Visual Basic Line. Now we're supposed to go to some token language where all the stuff that they did put in that are anything like VB6 is "deprecated". Like I imagine we aren't supposed to use the Sqr() function, we're supposed to use the System.Math.NumberMath.NumericOperations.SquareRoot() Function, which just so happens to take a special class type as it's argument, SquareRootArgument...

But, hey, it's faster.

(PS: I KNOW those aren't accurate depictions of the framework classes)

i want to know in VB6 what is forms is that classes or objects

Yes, a very good question. In short, a form is an object. According to Microsoft an object is encapsulated. That means it contains its own code and its own data. You don't have to program how to save its data. It's done for you. You set a property for a length, it saves the data for the length. Just fill in the properties box. In VB6 an object has properties, methods, and events.

Another interesting point is that you can use VB6 class modules to make your own objects. That is, with a class you can create your own class module with its own properties, methods, and events. And it can be instantiated or declared just like a regular form. In other words, your class module behaves like an object; because, in essence it fits the definition of an encapsulation: it contains its own code and data.

Option Explicit
Private MyScanner as cmScanner
Private MyCustomForm as CustomForm

Private Sub Form_Load()
' Instantiate the class just as you would a form
set MyScanner = New cmScanner
Set MyCustomForm = New CustomForm

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.