Home
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Database
Database General Discussion
PLS HELP!! How to override a default property???
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="neo.pet" data-source="post: 968" data-attributes="member: 465"><p>Hi all,</p><p></p><p>I am unable to derive a new class from ADODB.ConnectionClass. All I want to do is to override the 'Open' and 'Execute' methods but VB.net complains that all methods/properties must be overridden. So I have overridden all except for the default property 'ConnectionString'.</p><p></p><p><span style="font-size: 10px">I realize that VB.Net does not support default properties unless they accept parameters. So how can I override the base default property if it does NOT accept parameters but my derived class must accept parameters?? </span></p><p></p><p>-------------------------------------------------------</p><p>- When I define:</p><p><span style="font-size: 10px"><span style="color: #0000ff">Default</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Public</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Overloads</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Overrides</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Property</span></span><span style="font-size: 10px"> ConnectionString() </span><span style="font-size: 10px"><span style="color: #0000ff">As</span></span> <span style="font-size: 10px"><span style="color: #0000ff">String</span></span></p><p> ==> It complains parameters are required.</p><p></p><p>-------------------------------------------------------</p><p>- When I define:</p><p><span style="font-size: 10px"><span style="color: #0000ff">Default</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Public</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Overloads</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Overrides</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Property</span></span><span style="font-size: 10px"> ConnectionString(<span style="font-size: 10px"><span style="color: #0000ff">ByVal</span></span><span style="font-size: 10px"> index </span><span style="font-size: 10px"><span style="color: #0000ff">As</span></span> <span style="font-size: 10px"><span style="color: #0000ff">Integer</span></span>) </span><span style="font-size: 10px"><span style="color: #0000ff">As</span></span> <span style="font-size: 10px"><span style="color: #0000ff">String</span></span></p><p> ==> It complains that it doesn't override a property in the base class (b/c it accepts parameters)</p><p></p><p>-------------------------------------------------------</p><p>- The following is what I need but I'm not sure how to work around it:</p><p><span style="font-size: 10px"><span style="color: #0000ff">Default Public Overloads Overrides Property ConnectionString(ByVal index As Integer) As String</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"> Get</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"> ConnectionString = MyBase.ConnectionString</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"> End Get</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"> Set(ByVal Value As String)</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"> MyBase.ConnectionString = Value</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"> End Set</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff">End Property</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"></span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff">-------------------------------------------------------</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff">- Any input would be greatly appreciated!!</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"></span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff">thanks,</span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff">fed up </span></span></p><p><span style="font-size: 10px"><span style="color: #0000ff"></span></span></p></blockquote><p></p>
[QUOTE="neo.pet, post: 968, member: 465"] Hi all, I am unable to derive a new class from ADODB.ConnectionClass. All I want to do is to override the 'Open' and 'Execute' methods but VB.net complains that all methods/properties must be overridden. So I have overridden all except for the default property 'ConnectionString'. [size=2]I realize that VB.Net does not support default properties unless they accept parameters. So how can I override the base default property if it does NOT accept parameters but my derived class must accept parameters?? [/size] ------------------------------------------------------- - When I define: [size=2][color=#0000ff]Default[/color][/size][size=2] [/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Overloads[/color][/size][size=2] [/size][size=2][color=#0000ff]Overrides[/color][/size][size=2] [/size][size=2][color=#0000ff]Property[/color][/size][size=2] ConnectionString() [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size] ==> It complains parameters are required. ------------------------------------------------------- - When I define: [size=2][color=#0000ff]Default[/color][/size][size=2] [/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Overloads[/color][/size][size=2] [/size][size=2][color=#0000ff]Overrides[/color][/size][size=2] [/size][size=2][color=#0000ff]Property[/color][/size][size=2] ConnectionString([size=2][color=#0000ff]ByVal[/color][/size][size=2] index [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Integer[/color][/size]) [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size] ==> It complains that it doesn't override a property in the base class (b/c it accepts parameters) ------------------------------------------------------- - The following is what I need but I'm not sure how to work around it: [size=2][color=#0000ff]Default Public Overloads Overrides Property ConnectionString(ByVal index As Integer) As String Get ConnectionString = MyBase.ConnectionString End Get[/color][/size] [size=2][color=#0000ff] Set(ByVal Value As String) MyBase.ConnectionString = Value End Set End Property [/color][/size][size=2][color=#0000ff][/color][/size] [size=2][color=#0000ff]------------------------------------------------------- - Any input would be greatly appreciated!! thanks, fed up [/color][/size] [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
Database
Database General Discussion
PLS HELP!! How to override a default property???
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom