473,948 Members | 23,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "implementi ng interfaces" to me and perhaps
give me an example of implementing an interface that would help me implement
the IIneternetSecur ityManager 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
14 1772
Jim
Do you mean that you need to write a wrapper in C++ to expose this
functionality in VB.Net?
"RCS" <rs****@gmail.c om> wrote in message
news:Ei******** *********@newss vr33.news.prodi gy.com...
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.p lease> wrote in message
news:j4******** **********@bign ews5.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 IInternetSecuri tyManager::Proc essUrlAction Method
located at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@no spam.gmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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 ObjectThatImple mentsIList();
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.p lease> wrote in message
news:qf******** ***********@big news5.bellsouth .net...
I am using VB.Net 2.0 and I am completely new to the concept of
implementin g interfaces. Can anyone explain "implementi ng interfaces"
to me and perhaps give me an example of implementing an interface that
would help me implement the IIneternetSecur ityManager 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.c om> wrote in message
news:Vb******** ********@newssv r33.news.prodig y.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
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******** ******@TK2MSFTN GP09.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 #13
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,creat e
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.p lease> wrote in message
news:j4******** **********@bign ews5.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 IInternetSecuri tyManager::Proc essUrlAction Method located
at
http://msdn.microsoft.com/library/de...#SecurityZones.
How would this interface be implemented?
"W.G. Ryan - MVP" <Wi*********@no spam.gmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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 ObjectThatImple mentsIList();
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.p lease> wrote in message
news:qf******** ***********@big news5.bellsouth .net...
I am using VB.Net 2.0 and I am completely new to the concept of
implementi ng interfaces. Can anyone explain "implementi ng interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecur ityManager 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 #14
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.p lease> schreef in bericht
news:3s******** **********@bign ews5.bellsouth. net...

"RCS" <rs****@gmail.c om> wrote in message
news:Vb******** ********@newssv r33.news.prodig y.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 #15

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

Similar topics

4
17216
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 like? (The background is I don't know (I don't care indeed) all members in DataGrid, so I don't want to copy all members in DataGrid one by one.) public class GridEx : DataGrid { public GridEx()
2
2584
by: Derrick | last post by:
Is there an implement interface wizard is C#/Visual Studio? And, I have an interface, with many implentations, want to provide a Web Service implementation. What would be the standard practice? Implement the interface in the main asmx class? Or just have all interface methods available, but without explicitly implementing it? Thanks in advance! Derrick
3
2734
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 the basics of what I need to implement? I've seen all the MSDN articles on implementing events in managed C++ and I've gotten events to work without issue when implementing all the constructs
16
1418
by: Jim | last post by:
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/default.asp?url=/workshop/security/szone/overview/overview.asp#SecurityZones...
7
15733
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. Thanks. -- moondaddy@nospam.nospam
52
20962
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 'UselessJunkForDissassembly.IInvocableInternals.OperationValidate(string)' C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
4
4248
by: =?Utf-8?B?QmFqaS4=?= | last post by:
Hi, Can somebody suggest me, how can I implement a vc++ interface in C#.net. This interface has method CallMe( ) which is used as a CallBack from my main application. Thanks, Baji.
5
2428
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 that inherits IMyInterface but MyDerivedClass doesn't implement method DoSomething() it inherits it from the base class MyBaseClass. So the statement that a class must implement all method in an interface that
3
15761
by: =?Utf-8?B?Sm9uIEU=?= | last post by:
I have an interface class with maybe eight functions, defined in one workspace and am defining a class in a second workspace that derives from this interface. Unfortunately only 7 of the 8 functions in my derived class compile whilst just one of them refuses to be recognised, leading to an error message "...does not implement interface member...". Try as I might, I can't fix the error. I have cut and paste names so can rule out simple...
0
9989
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11587
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11182
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11355
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10695
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8258
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7432
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6341
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3548
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.