473,394 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do I implement an interface with VB.Net?

Jim
I am using VB.Net 2.0 and I am completely new to the concept of implementing
interfaces. Can anyone explain "implementing interfaces" to me and perhaps
give me an example of implementing an interface that would help me implement
the IIneternetSecurityManager interface mentioned under "Creating a
Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company's internal webbrowser.

Thanks for your help!
Dec 20 '05 #1
15 1631

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company's internal webbrowser.

Thanks for your help!

Why cross-post to a bunch of non appropriate NG's, please restrict your
postings to the vb NG only.

Willy.
Dec 20 '05 #2
Jim
Thank you for that most informative and helpful response.
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:eM*************@TK2MSFTNGP10.phx.gbl...

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company's internal webbrowser.

Thanks for your help!

Why cross-post to a bunch of non appropriate NG's, please restrict your
postings to the vb NG only.

Willy.

Dec 20 '05 #3
Jim:

In .NET we don't have multiple inheritance but by using interfaces, you can
get to the same place by and large. If I have an interface, then the
compiler knows that each fo the methods and properties must exist in the
class - it can count on them being there. So in it's simplest form,
implementing an interface is simply adding a property and method to your
class for each one in the interface. That way you can do this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and then
pass in anything that implements IList b/c it effectively "is" an IList
object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company's internal webbrowser.

Thanks for your help!

Dec 20 '05 #4
Jim - if you would, shoot me an email to WilliamRyan at gmail dotcom - I
answered your question briefly below, but I have some material that you will
probably find helpful - it's too much to simply post but if you'll shoot me
a private email, I'll do what I can to help.
"Jim" <re***@groups.please> wrote in message
news:NA*******************@bignews5.bellsouth.net. ..
Thank you for that most informative and helpful response.
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:eM*************@TK2MSFTNGP10.phx.gbl...

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I
could then implement a few more for my company's internal webbrowser.

Thanks for your help!

Why cross-post to a bunch of non appropriate NG's, please restrict your
postings to the vb NG only.

Willy.


Dec 20 '05 #5
Jim,
Thank you for that most informative and helpful response.

I am glad that the help from Willy did help you, I was ready to make a reply
however now I see that it is not needed anymore.

Because of your answer I assume that the most of us think about it this way.

Cor
Dec 20 '05 #6
Jim
On it's way...

Thanks!

"W.G. Ryan - MVP" <Wi*********@nospam.gmail.com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
Jim - if you would, shoot me an email to WilliamRyan at gmail dotcom - I
answered your question briefly below, but I have some material that you
will probably find helpful - it's too much to simply post but if you'll
shoot me a private email, I'll do what I can to help.
"Jim" <re***@groups.please> wrote in message
news:NA*******************@bignews5.bellsouth.net. ..
Thank you for that most informative and helpful response.
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:eM*************@TK2MSFTNGP10.phx.gbl...

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces"
to me and perhaps give me an example of implementing an interface that
would help me implement the IIneternetSecurityManager interface
mentioned under "Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I
could then implement a few more for my company's internal webbrowser.

Thanks for your help!

Why cross-post to a bunch of non appropriate NG's, please restrict your
postings to the vb NG only.

Willy.



Dec 20 '05 #7
Jim
That does help.

But how do I know what the object's interface looks like and how to
replicate it in VB.Net?

For example, the IInternetSecurityManager::ProcessUrlAction Method located
at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@nospam.gmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Jim:

In .NET we don't have multiple inheritance but by using interfaces, you
can get to the same place by and large. If I have an interface, then the
compiler knows that each fo the methods and properties must exist in the
class - it can count on them being there. So in it's simplest form,
implementing an interface is simply adding a property and method to your
class for each one in the interface. That way you can do this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and then
pass in anything that implements IList b/c it effectively "is" an IList
object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company's internal webbrowser.

Thanks for your help!


Dec 20 '05 #8
RCS
Yikes.

It might be helpful if you stuck to one question at a time and sent it to
one newsgroup. Crossposting is bad.

Interfaces require a bit of explanation. If you are not familiar, just ask.

HOW to implement them in VB (sorry to the other newsgroups), you do
something like this:

Public Class MyClass
Implements System.IFormattable

End Class

in C#, it's something like this:

public class MyClass : System.IFormattable
{
}

You will then obviously need to implement the members that the interface
describes.. hope that helps

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company's internal webbrowser.

Thanks for your help!

Dec 20 '05 #9
RCS
If I didn't know any better, these look like C++ API's and I couldn't find a
..NET implementation of them.. so I would guess (based on a cursory glance)
that there isn't an easy way to use this functionality in VB without
wrapping it first..

"Jim" <re***@groups.please> wrote in message
news:j4******************@bignews5.bellsouth.net.. .
That does help.

But how do I know what the object's interface looks like and how to
replicate it in VB.Net?

For example, the IInternetSecurityManager::ProcessUrlAction Method located
at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@nospam.gmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Jim:

In .NET we don't have multiple inheritance but by using interfaces, you
can get to the same place by and large. If I have an interface, then the
compiler knows that each fo the methods and properties must exist in the
class - it can count on them being there. So in it's simplest form,
implementing an interface is simply adding a property and method to your
class for each one in the interface. That way you can do this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and then
pass in anything that implements IList b/c it effectively "is" an IList
object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I
could then implement a few more for my company's internal webbrowser.

Thanks for your help!



Dec 20 '05 #10
Jim
Do you mean that you need to write a wrapper in C++ to expose this
functionality in VB.Net?
"RCS" <rs****@gmail.com> wrote in message
news:Ei*****************@newssvr33.news.prodigy.co m...
If I didn't know any better, these look like C++ API's and I couldn't find
a .NET implementation of them.. so I would guess (based on a cursory
glance) that there isn't an easy way to use this functionality in VB
without wrapping it first..

"Jim" <re***@groups.please> wrote in message
news:j4******************@bignews5.bellsouth.net.. .
That does help.

But how do I know what the object's interface looks like and how to
replicate it in VB.Net?

For example, the IInternetSecurityManager::ProcessUrlAction Method
located at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@nospam.gmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Jim:

In .NET we don't have multiple inheritance but by using interfaces, you
can get to the same place by and large. If I have an interface, then
the compiler knows that each fo the methods and properties must exist in
the class - it can count on them being there. So in it's simplest form,
implementing an interface is simply adding a property and method to your
class for each one in the interface. That way you can do this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and then
pass in anything that implements IList b/c it effectively "is" an IList
object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces"
to me and perhaps give me an example of implementing an interface that
would help me implement the IIneternetSecurityManager interface
mentioned under "Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I
could then implement a few more for my company's internal webbrowser.

Thanks for your help!



Dec 20 '05 #11
Jim

"RCS" <rs****@gmail.com> wrote in message
news:Vb****************@newssvr33.news.prodigy.com ...
Yikes.

It might be helpful if you stuck to one question at a time and sent it to
one newsgroup. Crossposting is bad.


I only cross-posted because I knew that C/C++/C# programmers may hae the
information that I seek. Posting to the VB.Net ng could work, but since I
am talking about C++ APIs, I thought the groups selected were appropriate.

And, I have been taken to task for posting the same questions in separate
posts to separate groups because it evidentially eats up bandwidth for some
USENET users that pay for bandwidth usage.

In fact, based on those conversations, I thought that I was doing people a
favor by sending the question to several ngs at once rather than posting
separately to the ngs.

I don't know......I am just seeking knowledge wherever I can find it. Sorry
if I stepped on any toes in the process.

Dec 20 '05 #12
RCS
Well, basically - you'd need to make a .NET assembly that has this
functionality in it, so it will be easily accessible via VB. VB.NET can only
easily/natively see .NET and COM components. It can't see non-.NET or native
Win32 API's, without some coding.

There are almost always ways to use Win32 API's in non-C++ languages, but it
tends to be clumsy. Bottom line, if you know C++ - write a managed/.NET
assembly that exposes this functionality.. or, try to write a VB.NET
assembly that uses these API's directly. There will likely be no
documentation and nowhere to turn, except newsgroups, if you get stuck..

Good luck..

"Jim" <re***@groups.please> wrote in message
news:Ai*******************@bignews5.bellsouth.net. ..
Do you mean that you need to write a wrapper in C++ to expose this
functionality in VB.Net?
"RCS" <rs****@gmail.com> wrote in message
news:Ei*****************@newssvr33.news.prodigy.co m...
If I didn't know any better, these look like C++ API's and I couldn't
find a .NET implementation of them.. so I would guess (based on a cursory
glance) that there isn't an easy way to use this functionality in VB
without wrapping it first..

"Jim" <re***@groups.please> wrote in message
news:j4******************@bignews5.bellsouth.net.. .
That does help.

But how do I know what the object's interface looks like and how to
replicate it in VB.Net?

For example, the IInternetSecurityManager::ProcessUrlAction Method
located at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@nospam.gmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Jim:

In .NET we don't have multiple inheritance but by using interfaces, you
can get to the same place by and large. If I have an interface, then
the compiler knows that each fo the methods and properties must exist
in the class - it can count on them being there. So in it's simplest
form, implementing an interface is simply adding a property and method
to your class for each one in the interface. That way you can do
this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and
then pass in anything that implements IList b/c it effectively "is" an
IList object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
>I am using VB.Net 2.0 and I am completely new to the concept of
>implementing interfaces. Can anyone explain "implementing interfaces"
>to me and perhaps give me an example of implementing an interface that
>would help me implement the IIneternetSecurityManager interface
>mentioned under "Creating a Customized URL Security Manager" on
>http://msdn.microsoft.com/library/de...#SecurityZones
>and mentioned under "Download Control" on
>http://msdn.microsoft.com/library/de...nload_Control?
>
> This would help me a great understand implementing interfaces and I
> could then implement a few more for my company's internal webbrowser.
>
> Thanks for your help!
>



Dec 20 '05 #13
Cor - I think it's safe to answer if you want to give it a shot - I suspect
Jim's answer may have been polite sarcasm.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Jim,
Thank you for that most informative and helpful response.

I am glad that the help from Willy did help you, I was ready to make a
reply however now I see that it is not needed anymore.

Because of your answer I assume that the most of us think about it this
way.

Cor

Dec 20 '05 #14
Well it depejnds on the interface. If you're in the IDE, you can find out
the methods by hitting Tab after you use the Implements InterfaceName - this
will shell out all the methods for you. To implement the interface,create
your class and then use Implements and then the interface name, when you
hit tab, it will fill in the method stubs for you.
"Jim" <re***@groups.please> wrote in message
news:j4******************@bignews5.bellsouth.net.. .
That does help.

But how do I know what the object's interface looks like and how to
replicate it in VB.Net?

For example, the IInternetSecurityManager::ProcessUrlAction Method located
at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@nospam.gmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Jim:

In .NET we don't have multiple inheritance but by using interfaces, you
can get to the same place by and large. If I have an interface, then the
compiler knows that each fo the methods and properties must exist in the
class - it can count on them being there. So in it's simplest form,
implementing an interface is simply adding a property and method to your
class for each one in the interface. That way you can do this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and then
pass in anything that implements IList b/c it effectively "is" an IList
object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I
could then implement a few more for my company's internal webbrowser.

Thanks for your help!



Dec 20 '05 #15
Jim,

I think that we are talking about different interfaces.

As we are talking in VB.Net than an Interface describes a contract what a
class has to consist, which makes it possible to access that class using
that interface.

You have as well all kind of other Interfaces by instance a UI User
Interface what is totaly something different.

An Api Apllication Program Interface is an interface between your program
and the OS, however not seen as that when we talk about interfaces.

I first thought that you was asking for an Interface, now I understand that
you ask it for an API.

http://msdn.microsoft.com/library/de...indowsAPIs.asp

Probably it is better to start in one newsgroup (related to your expected
result) and give what you want it right name, if it is than wrong, people
will help you to a better newsgroup.

I hope this helps,

Cor

"Jim" <re***@groups.please> schreef in bericht
news:3s******************@bignews5.bellsouth.net.. .

"RCS" <rs****@gmail.com> wrote in message
news:Vb****************@newssvr33.news.prodigy.com ...
Yikes.

It might be helpful if you stuck to one question at a time and sent it to
one newsgroup. Crossposting is bad.


I only cross-posted because I knew that C/C++/C# programmers may hae the
information that I seek. Posting to the VB.Net ng could work, but since I
am talking about C++ APIs, I thought the groups selected were appropriate.

And, I have been taken to task for posting the same questions in separate
posts to separate groups because it evidentially eats up bandwidth for
some USENET users that pay for bandwidth usage.

In fact, based on those conversations, I thought that I was doing people a
favor by sending the question to several ngs at once rather than posting
separately to the ngs.

I don't know......I am just seeking knowledge wherever I can find it.
Sorry if I stepped on any toes in the process.

Dec 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter | last post by:
I want to copy a parent class instance's all datas to a child's. It's actually a C++'s copy constructor. But why the following code does not work - there is a compile error! How it should look...
3
by: Brett Hall | last post by:
I have a VB.NET interface that my managed C++ code is to implement. I seem to be stuck implementing an event defined in that interface. Does anyone have a simple code snippet that will show me...
7
by: moondaddy | last post by:
If I'm in a class that inherits an interface, is there a shortcut key that will write the implementation of the interface into the class? I remember seeing something like this in vb.net. ...
52
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
5
by: Tony Johansson | last post by:
Hello! Assume you have the following interface and classes shown below. It is said that a class must implement all the methods in the interface it inherits. Below we have class MyDerivedClass...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.