Re: dll custom properties
From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 07/12/04
- Next message: Jon Skeet [C# MVP]: "Re: Strings.. Objects or not???"
- Previous message: Cor Ligthert: "Re: Create a property in usercontrol ?"
- In reply to: Bryan V.: "dll custom properties"
- Next in thread: Herfried K. Wagner [MVP]: "Re: dll custom properties"
- Reply: Herfried K. Wagner [MVP]: "Re: dll custom properties"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Jul 2004 11:29:14 +0200
VB.NET is object oriented and requires that properties are members of a
class. You will create a class as a container for the properties and declare
them in much the same way.
Generally, a class with properties must be instantiated before the
properties can be used so you might do something like....
public class MyClass
private _int as Integer
public property MyInt as Integer
get
return _int
end get
set(byval value)
_int=value
end set
end property
end class
In your application that uses the DLL you create a new instance of "MyClass"
and adjust it's properties...
Imports MyDllNamespace
public class someclass
'create an instance of the class and hence it's properties
private c as MyClass=new MyClass()
public sub someSub()
'use the class properties
c.MyInt=10
end sub
end class
You can create classes that have static or shared properties. These don't
require an instance of the containing class and can be used as global
variables. I guess this was what you are referring to when you asked the
original question. Although this works, it's not a particularly good design
practice and you should begin thinking more in object-oriented terms where
properties are members of classes that have a lifetime.
-- Bob Powell [MVP] Visual C#, System.Drawing The Image Transition Library wraps up and LED style instrumentation is available in the June of Well Formed for C# or VB programmers http://www.bobpowell.net/currentissue.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/gdiplus_faq.htm The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml "Bryan V." <chaoticdriver@hotmail.com> wrote in message news:O9eBTd8ZEHA.2488@tk2msftngp13.phx.gbl... > Hello, > I am a long time VB6 user, and am trying to make a VB.Net DLL. I am having > one problem using the new language, how do I add custom properties to a DLL? > The properties that a user can adjust at design time. > > Thanks! > Bryan > >
- Next message: Jon Skeet [C# MVP]: "Re: Strings.. Objects or not???"
- Previous message: Cor Ligthert: "Re: Create a property in usercontrol ?"
- In reply to: Bryan V.: "dll custom properties"
- Next in thread: Herfried K. Wagner [MVP]: "Re: dll custom properties"
- Reply: Herfried K. Wagner [MVP]: "Re: dll custom properties"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|