Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Property in a form
Message
From
26/10/2004 11:01:54
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
00954513
Message ID:
00954554
Views:
15
Shawn,

It only needs to be public if you need it outside of your class (in this case, outside of your form). If not, then either private or protected is fine.

And, if it *does* need to be public, it doesn't necessarily need to be a property (with a get/set), although that's probably better (in case you want to be able to set it via the property sheet, or in case you need to have extra code in the get/set).

~~Bonnie



>Okay, i don't get it?
>
>Why would i have a public property called
>CurrentDataGridHitRow and a private _currentDataGridHitRow
>
>Wouldn't it be easier to use a protected var versus a property.
>
>Maybe my designis bad, and it needs a proteted var versus a property.
>
>I was using the property to hold the DataRow, so i can access it from any where in the winform or pass it as a datarow somewhere else.
>
>Would a Var be better????
>
>
>
>
>
>>Hi Shawn:
>>
>>You have a recursive property. Try this:
>>
>>
>>private DataRow _currentDataGridRow
>>public DataRow CurrentDataGridHitRow
>>{
>>	get{return this._currentDataGridRow;}
>>	set{this._currentDataGridRow = value;}
>>}
>>
>>
>>HTH,
>>
>>--Paul
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform