OO Design: Use Getters/Setters Internally?

Dec 28, 2010

This is probably a stupid question, but when accessing an attribute from within a class is it generally better to access the private variable directly, or access it using the getter/setter? Of course the whole point of encapsulating attributes is to allow changes to the underlying code without affecting anything that uses it. Should that also apply to the class itself? Or is it a case where the class should have full knowledge, and so shouldn't have to use the getters/setters?

View 1 Replies


ADVERTISEMENT

Getters And Setters From Vb 6 To .net?

Oct 1, 2010

How do I convert the following? I'm porting a vb 6 app to vb .net.

Public Property Get Width() As Long
Width = m_lWidth
End Property
Public Property Let Width(ByVal value As Long)
m_lWidth = value

[Code]...

View 2 Replies

.NET Support Automatic Getters And Setters On Properties?

Apr 7, 2011

In C# I can do this: public string myProperty { get; private set; }This is referred to as an "automatic getter/setter" (from what I've heard). Does VB.NET support these? So far, with my properties, all I can do is this:

[Code]...

View 2 Replies

Advantages Of Property Keyword Over Using A Private Field With Getters And Setters?

May 21, 2011

In VB.NET, what are the advantages of using the Property keyword rather than:[code]Coming from Java I tend to use this style rather than Property...End Property - is there any reason not to?

View 4 Replies

Serializing Multiple Objects Internally

Nov 11, 2009

I am in the process of writing a base class for gadgets that will be displayed on a form.I want the gadget to be fully self contained and reusable.At this point it does everything that I need it to do EXCEPT, i'm having trouble figuring out a creative way to serialize my objects using only one object.I have a feeling the answer lies somewhere within the context of using shared functions but I'm having trouble wrapping my mind around it.

View 1 Replies

Store Settings/Resources Internally?

Feb 1, 2009

Does anyone know how to store settings/resources internally?I have this code (example).msgbox(my.settings.message)But this method generates a .resx file with the application.

View 3 Replies

Value Of That Object Internally Within My Class From Different Threads?

Oct 22, 2009

Lets say I have got a class level boolean, defined like so:

vb Private _ServerRunning As Boolean = False

and it is exposed like so:vb Public ReadOnly Property ServerIsRunning() As Boolean
Get
Return _ServerRunning
End Get
End Property

Do I need to worry about thread safety when modifying the value of that object internally within my class from different threads?

View 4 Replies

Why Do Property Setters Get Called More Often Than Expected

Oct 12, 2011

I have observed a behaviour in VB.net where property setters get called more often than seems necessary, in conjunction with calls to the sister setter method.

Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Console.WriteLine("Calling WorkReferenceTypeByReference")
WorkReferenceTypeByReference(ReferenceTypeData)
Console.WriteLine("Called WorkReferenceTypeByReference")
[Code] .....

Note the spurious call to the property setter following the method execution. I am supposing this behaviour is produced as a safety measure against inadvertently modifying the underlying property, despite this potentially being the intent. This behaviour in the case of ByRef vs ByVal usage is easily solved by choosing appropriate ByVal keyword, however hase recently noticed a more insidious behaviour, one that has caused a stack overflow of repeated calls, since the setter call would update a value that called the getter only.

Public Sub DoSomething()
Dim a As New CustomObject(anotherObject.AProperty(getterArgument))
End Sub
Public Class AnotherObject
Public Property AProperty as SomeType
[Code] .....

In the previous example, calling DoSomething() would fire the AProperty getter method, but then after that usage, would fire the setter method, which by program logic calls DoSomething() again. It is the automatic calling of the setter that puzzles me.

View 2 Replies

Asp.net - Benifit/Advantage Of C# Property Properties - Private Access Modifiers For Setters?

Jan 25, 2012

Below is the class with a property.

public class abc
{
public int MyProperty { get; private set; }
}

What's the benefit of typing private access modifier in setter ?

View 5 Replies

External Class To Be Accessed Internally Within ANOTHER Class?

May 16, 2009

Recently, I was experimenting with accessing classes within other classes. From an earlier post, I learned some things about class architecture, but don't think I understood it as well as I HOPE I do now.

I came to the following assessment:If you require an external class to be accessed internally within ANOTHER class, there must be an internal "placeholder" for the immediate values contained in any instance of the external class. That internal placeholder is a structure declaration that has the same architecture as the external class, AND the names of the external class and the internal structure must be identical.

View 5 Replies

Css - Design A Webpage In Asp.net Design View Which Support Multi Resolution?

Nov 26, 2010

I have created my webpage in asp.net in 1024*768 resolution, my problem was that when i change my monitor resolution then the controls in my webpage will be displayed in unmanaged manner .

How to arrange items in my webpage which support multiple resolution ...

Whatever the resolution of my monitor the controls in my webpage will display as it is as managed in 1024*768 reolution !

View 1 Replies

Form Design - Cannot Expand Vertically In Design View

Jun 27, 2011

I seem to have reached a limit on the size of the form. I cannot make the form longer and I need to add more fields. Is there a limit on how many fields can be included in a form?

View 1 Replies

C# - Design Reference And Object Oriented Design Of A CRM

May 25, 2011

I searched codeplex and google. I have found so many such as tustena but unfortunately they are not domain driven based and in these solutions I could not find a good modelling documents or references. i am a newbie in CRM but I am sensetive to design it with solid object-oriented fundamentals. Any reference or open source solution especifically for CRM design and implementaion in .NET? Cheers

View 1 Replies

Design An SMS SENDER Using VB .NET?

Jun 6, 2009

I'm new to VB .NET. I would like to design a sms sender application which could use internet connectivity to send messages to any mobile number. Should I use any messaging APIs? Where should I start?

View 1 Replies

Asp.net - Design A Game Web App?

Jun 21, 2009

i know vb.net, but have had no experience at all with web programming. i need to make a web app that can run in a browser where there is a board game and pieces that you can move around. can someone help me get started? are there any examples in asp.net?

i need something like this:

[code].....

i don't know what language this is built in, but i would much prefer vb.net. i would like the pieces to be pictures instead of text.

View 5 Replies

Cost Of VB Or Web Design?

Mar 14, 2010

I need to know basic compiter skills,abbreviations ,what is aC++ and so oncan I get that here or would I be better off at a Technical school?

View 2 Replies

Design A Custom GUI?

Jul 7, 2011

I'm just wondering how you'd go about designing something like this:

I know its made in Photoshop, but is there a program/addon that the transition into a GUI easier? Or is it all code?

View 34 Replies

Design Of Vb Interface To Be The Best?

May 6, 2012

i am warsame Essa Mohamed life in Hargeisa Somaliland.

design of vb interface to be the best?

View 2 Replies

Design Own Rtb Which Can Act Like A Container?

Jul 21, 2009

is there a way to design my own rtb which can act like a container? I mean I want to add the functionality of a container e-g panel to rtb. How can I start it?

View 7 Replies

How To Design A Calculator

Jun 22, 2010

How can i design a calculator?

View 2 Replies

Lost All My Design And Can't See ?

Oct 3, 2009

A little but pissed off at the moment as I have just lost a few hours of work. While I was trying to get a form to resize better (so you can make the form bigger and have all the panels and therefore things inside the panels take up the same percentage of the form), I thought about looking in the designer code to see if anything in there would be easy to change to make it work the way I wanted.

Upon finding what I thought was going to be a good bit of code to edit (code that placed the panel in position), I changed it so that panel2 would find where panel1 was (in the y axis), add panel1's height onto panel1's Y location and use that value as panel 2's Y location:

Me.Panel5.Location = New System.Drawing.Point(0, Panel1.location.Y + Panel1.height)

When I switched back to the visual designer view it came up with a warning page (blue bar across the top of the page saying "To prevent possible data loss before loading the designer, the following errors must be resolved:".Therefore I went back into the designer code and deleted what I had previously done and was a little bit annoyed that I couldn't use that code which I hoped I could.Upon going back to the visual design page everything was gone so I went back to the design code but everything was still there.I sighed in relief and ran the program and everything loaded properly so I decided to quit and reload the project to revert to before the incident occurred to be able to see the design in design view.When I reloaded the project everything was still gone and I then found out that the code from the design had gone too meaning I had lost it all. The code that I created would work in the vb coding, I have tried it.

View 2 Replies

Way To Design A Receipt

Dec 19, 2009

I can't find the right way to design areceipt using vb.net.

View 1 Replies

Where Did Form Design Go

Oct 21, 2011

I booted my computer today and tried to load my project. All I can find is the user interface.vb with all my code. The program runs fine, but I cannot find Form1.vb. How can I retrieve it?

View 1 Replies

Create A Design In Run-time?

Dec 5, 2011

I'm a newbie in visual basic dot net. I tried to create a design in run-time. Here's my simple code.

Dim frmLogin As New Form
Dim lblUserName, lblPassword As New Label
Dim txtUserName, txtPassword As New TextBox

[code].....

View 1 Replies

.net - MVVM Design Consideration

Feb 3, 2011

I am currently developing a new WPF application and have the majority of my business logic layer developed (ie my Models). I am about implement ViewModel classes to represent one feature of my application. I am quite new to the Model-View-ViewModel pattern and I have a question about which approach would be best to use when implementing my ViewModel classes.

[Code]...

View 3 Replies

.net 2.0 - .net Winforms Design / Layout?

Dec 2, 2010

I am working on a windows forms project that will allow a user to have an interface to the database, and another will be a nightly run process file that will update the database table.The user will add new records to the table, whereas the nightly process will update the columns with new values (think mortgage interest rates)

Both these projects will be using the same business logic component that has the calculations needed to enter values into the table.The way I am figuring this out, is that I will have two exe's (one for the interface and one for the nightly process) and have a central object that will host the calculations. What would be the best object for this purpose?A class file?A windows service? (I want to stay away from a windows service, because it will have to be running all the time)

View 2 Replies

.net Inventory Form Design?

Feb 19, 2011

i m trying to develop a billing sw using vb.net as front end and ms sql as back end. i 'll need two tables for this. So, how can i design avb.net form for this purpose.... means what tools should be used for item entries

View 2 Replies

Achieve My ToolStrip Design?

May 26, 2011

How to achieve my ToolStrip design the same as the picture below?

View 5 Replies

Articles On Architecture And Design?

Nov 6, 2009

I was wondering does anyone know where i can find some good books and or articles covering the architecture and design of OOP applications. Also I need a book that explains how to structure an application as it relates to the data tier, business logic tier, and the front end.

View 6 Replies

Best Way To Design Accounting Accounts

Jun 14, 2012

What a best way to design accounting accounts tables in database and link to vb.net.is it design one table for the accounts names and balances and another table for the journal

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved