By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

dll custom properties

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Bryan,

What exactly do your mean by custom Properties? If you mean object properties, then it is just like in Vb, with a slightly different syntax.

Public Property MyProperty()
Get

End Get
Set(ByVal Value)

End Set
End Property

Regards,
Anand
VB.NET MVP
http://www.dotnetindia.com
"Bryan V." wrote:
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

Nov 20 '05 #2

P: n/a
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." <ch***********@hotmail.com> wrote in message
news:O9**************@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

Nov 20 '05 #3

P: n/a
* "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> scripsit:
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)

^^^

'... As Integer'.

:-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

P: n/a
Sorry.. C# programmer disease :-)

--
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


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OX**************@TK2MSFTNGP10.phx.gbl...
* "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> scripsit:
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)

^^^

'... As Integer'.

:-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.