Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Inherit a control but set different default properties

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Podmore - 13 Feb 2006 20:40 GMT
I have created a new control in VB.NET that Inherits a ListView so that I can
add some of my own functionality. One of the other things I would like to do
is change some of the appearance of the grid when it’s placed on a form in
design view. The company I work insists on Grid Lines, Full Row Select, No
Multi Select and the View set to Details. I can do this in New but this
doesn’t allow the properties to be changed.

So what I want to do is be able to draw the new control on a form in design
view and have things like GridLines set to True rather than the default of
false. Anyone got any ideas how to accomplish this?

Thanks.
Chris.
Tim Wilson - 13 Feb 2006 21:55 GMT
You'll need to hide or override the existing property, specify the
DefaultValueAttribute with the appropriate default value, and also set the
default value into the property from within the constructor (Sub New).
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemcomponentmodeldefaultvalueattributeclasstopic.asp


Signature

Tim Wilson
.NET Compact Framework MVP

> I have created a new control in VB.NET that Inherits a ListView so that I can
> add some of my own functionality. One of the other things I would like to do
[quoted text clipped - 9 lines]
> Thanks.
> Chris.
Chris Podmore - 14 Feb 2006 09:24 GMT
I have tried what you suggest and it now appears to work, I was setting
Me.GridLines = True in Sub New and in the Property also returning & setting
Me.GridLines, I have changed this to MyBase.GridLines in all three places and
it now appears to work.

Thanks for you help.
Chris.

> You'll need to hide or override the existing property, specify the
> DefaultValueAttribute with the appropriate default value, and also set the
[quoted text clipped - 17 lines]
> > Thanks.
> > Chris.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.