help provider on EVERY form

D

Darin

I have hundreds of forms and I have a class defined as cMyForm which is
what every form is (inherits cMyForm as the start instead of
system.windows.forms.form)

When I add a helpprovider to a form, it creates:

Friend with events helpprovider1 as system.windows.forms.helpprovider

and:

me.helpprovier1=new system.windows.forms.helpprovider

With some other code defining which file.

All of my forms (hundreds) use the same file. I don't want to HAVE to
manually add the help provider to every form. I would like to do that in
the class definition of cMyForm. How can I do that? Would I put the
helpprovider in the SUB NEW of my class or what?

Darin
 
C

Cor Ligthert

Hi Darin,

I did give this morning this explanation for agnes.

In VB.net I use classes. There are two types; the names are so called names.
- The shared class (which contains a lot (mostly all) of shared methods
and properties)
- The non-shared class

From a non-shared class you have to create an object in your programming by
instancing them.
Dim mynewClassObject as New myNonSharedClass.
Dim myvalue = mynewClassObject.value

Shared members, events and properties in a class can directly called by
their name
Dim myvalue = mySharedClass.value

The benefit above a module is that you shall call them instancing or using
their name, with which they become immediately recognizable in your project.

The benefit from a non-shared class above a shared class is that it uses
less memory. It goes out of scope when the procedure ends where it is in
created (which is not true, the truth is when there are no references
anymore to it).
-------------
When I understand you well, than you can make a shared class, which holds
the data from your files and use its methods to read and write.

I hope this helps?

Cor
 
D

Darin

Ok, but I am still at a loss.

My form class is:

Public Class cMyForm
inherits form
sub new()
mybase.new()
mybase.startposition=formstartposition.centerscreen
end sub
end class

So, do I want to add in NEW the part about the helpprovider, sub as:

sub new()
mybase.new()
mybase.startposition=formstartposition.centerscreen
dim xhelp as new helpprovider
mybase.controls.add(xhelp)
end sub

Darin
 
C

Cor Ligthert

Hi Darin,

New is a sub, so when you create it there it will be gone, it has to be on a
global place on a form.

That will be in the start of your program. By instance direct after the
class declaration.
Something as simple sample
\\\
Private xHelp as new helpprovider
sub new()
mybase.new()
mybase.startposition=formstartposition.centerscreen
Me.xHelp.HelpNamespace = "mspaint.chm"
end sub
////
The controls which are beneath the form when you use the designer, do you
not have to add to the form (me.controls).

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top