What's The Relation Between Classes And Objects

Oct 14, 2009

relation between Classes and Objects with an example.Md. Marufuzzaman

View 7 Replies


ADVERTISEMENT

.net - Querying Twice-separated-or-more Objects In A Relation Chain?

Apr 20, 2010

Not sure if I am using the correct term, but it's not child/parent since they aren't nested objects. In my application I've got a User, UserUserGroup, and UserGroup objects which are pretty standard, UserUserGroup is a linking object with corresponding IDs. I am using Linq-to-SQL so unforunately it doesn't used nested objects, but it still knows the relation.

[Code]...

View 1 Replies

Array Of Child Objects In Nested Classes And Accessing Child Objects In .Net

Jan 3, 2012

I have a nested class, let's call it class1 and it has class2 inside it; VB.Net eg:[code]

1) How can I define X number of Class2 objects[let's call it: Node(x) array]** with NEW() subroutine called?' this raises error: dim cls2(n) as new class2 end sub.

2) How can I return actual number of Node() array? [code]Outside my class in main project I define cls1 object:[code]Now an array of class2 is created inside cls1.

3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?

I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don't have the code now.

View 1 Replies

Classes And Objects?

Aug 29, 2010

The 1st part of the code required me to write a class definition for a class(Worker). The class should include Private variables and Property procedures for a worker object's name and salary.

The salary may contain a decimal place. The class should also contain two constructors:a default and a parameterized.

The second part for the code indicates that I need add a method named GetNewSalary to the Worker class.The method should calculate a Worker objects new salary, which is based on a raise percentage provided by the application using the object.

Before calculating the new salary, the method should verify that the raise percentage is greater than or equal to zero. If the raise percentage is less than zero the method should assign the number zero as the new salary

There are three text boxes which allows the user to enter the employees name current salary and raise percentage....the calculate button will display the new salary in the new salary label box...so far here is what I have for the worker class.

The Class for the code had to be written from scratch. Can you please look over the class code and see if I need to chang anything....that will allow the program to run.[code...]

View 1 Replies

Accessing Objects From Other Classes In ASP.NET

Sep 7, 2010

In ASP.NET I have a form that has a Textbox named txtOutput and a button. In the main file.aspx.vb I can call a function from the button handler and in that function I can have [code]I have a bunch of functions in several other classes. For instance I have a class named AbleCommerce that does some database functions. These functions are called from my main class. In those functions, however, I have no visibility of txtOutput.All of my classes are, unfortunately, in the default namespace which I understand is not optimal but didn't seem to impact this issue.

View 2 Replies

Collection Of Objects Of Different Classes?

Dec 28, 2011

suppose I have a collection of objects of different classes (like controls in a form), and all of their classes have a MyMethod extension method. How do I have the appropriatemethod be called for each object, depending on its type?or example,

For Each ctrl In Me.Controls
'call ctrl real type's MyMethod
Next

[code]....

View 6 Replies

Creating Classes And Objects?

Apr 10, 2011

1) Add a Private variable named _area2) Associate the _area variable with a Property procedure called Area3) Change the CalculateArea method to a Sub procedure. The method should calculate the area and then assign the result to the _area variable.4) Include a parameterized constructor in the class. The constructor should accept one argument: the side measurement. After using the Public property to initialize the Private variable, the constructor should automatically call the CalculateArea method.At this point I believe I've completed the first 2 steps for the Square method, but I'm not sure where to go from therHere is my code for the Square class and the Main Form, in tha order:

Public Class Square
Private _side As Integer
Private _area As Integer

[code].....

View 3 Replies

Programmed For A While And Mainly Used Classes As Objects?

Mar 5, 2010

Pursuing the Microsoft Certified Professional Developer Certification and working through the training kit.I've programmed for a while and mainly used classes as my objects.The training certification book I'm working through has a section on structures. they look very similiar to classes so my question is: why use them? Do they offer something that creating a class doesn't? What's the difference between structures and classes?

View 8 Replies

Trying To Understand Classes And Objects ?

Jun 5, 2010

I've been trying to understand classes and objects. Yes, I'm thick headed and slow, but I made the decision to go to .Net and I am determined to improve my coding skills to be more efficient. I have spoken to Atma several times on the topic and read most of his posts concerning classes and objects, but still came away a little baffled (He's really advanced for me yet). I needed a simplistic analogy for a reference point to begin understanding. I was reading about OOP written by MikeJ in the following thread/post ...[URL] and it all started to become clear in this statement , but I would like some reassurance that I'm getting it ..."A car IS-A vehicle, while a dog HAS-A tail. The car would be an object declared as type Vehicle, while the dog would have a member that IS-A tail. However, Fido IS-A dog. The dog class is the base template for all dog objects, so when we declare Fido as a dog, Fido is an object. Since Fido IS-A dog, Fido HAS-A tail."

From this I have taken the following understanding...

Vehicle ... ' Class
Car ....... ' Object
Truck ... ' Object
Van ....... ' Object

And from that can I infer that this is true?

Dog ....... ' Class
Fido ... ' Object
Tail .. ' Member of Fido

So to apply this to a program I wrote recently that tracks Generator service...

Generator ' Would be the class
Brand X ' Would be an object
Spark Plug ' Would be a member
Gas Tank ' Would be a member
Brand Y ' Would be an object
Brand Z ' Would be an object

This statement also helped ...

""Class" and "object" are sometimes used interchangeably. However, classes describe the structure of objects, while objects are instances of classes. Each instance is an exact copy of its base class. Because an object is an "instance" of a class, the act of creating an object is called instantiation. To describe it better, a class is a blueprint, and an object is a building based on that blueprint". I can understand this (I think) and it refers to a basic template such as ..."Generator" (my class or blueprint or template) Generators have an engine, powerplant, fuel tank, etc. These are basic requirements to be a generator. (Template or Blueprint) They can differ by Brand of engine, Size of powerplant, and type of fuel used. (Based on template or blueprint) Do I have it down now? MikeJ also made this statement ..."you can't access certain types of class members from outside of the class itself." From this I assume you would need to assign a Global variable the value of the class member if you needed to use it outside of the class?

View 17 Replies

Base Classes On Proxy Objects

Sep 25, 2011

I have a webservice that is wrapped up by a data access object and is accessed by many different UI controls.

The proxy objects look something like this:

Public Class WebProxyObject1
' Common properties, there are about 10 of these
Public Name As String

[Code]....

View 1 Replies

Creating A Class That Contains Other Classes/Objects?

Aug 27, 2010

I'm wondering on how you would go abouts instantiating a class that contains other complex objects. for example an Payment Class which has Date,Time, etc.. and it also holds a reference to a paymethod object which has id,Type,Description etc.. How do you instantiate the payment class with all the other objects without one or the other failing, how do you create the payment class which doesn

View 4 Replies

Multiple Classes For Serialize Objects?

May 9, 2009

I have one class with <Serialize> attribute called Tree. And Tree class has an arraylist of TreeNode classes. Is it possible to use Soap to convert the Tree class and arraylist of TreeNode classes to one xml file or binary file? If it is possible, do i need to use <Serialize> attribute on TreeNode classes too? If not, what should i do then?

View 3 Replies

Reference Objects On Webpages In The Classes

Feb 26, 2010

I have a project where a email is sent when the user clicks send on the web page, however the content of the email will change depending on what is inputted by the user. I have added classes to my project so that depending what is selected by the user different classes are selected and as such different emails then sent from the project.

[Code]...

View 9 Replies

Creating Classes For Master Child Objects

Dec 26, 2010

I have a Clients master object and then a number of child objects whose exact number is not known in advance such as Client-Contacts, Client-Payments etc, all of which have a one-to-many relationship with the Client master object.How do I define classes for such a scenario? Do I for instance create the master Clients class and can then I create an array of class somehow for child objects?

View 2 Replies

Easy Way To 'rewrite' To Take Advantage Of Classes And Objects?

Jul 2, 2009

I have a VB.NET web app that is about 2000 lines of code, contains about 20 different subroutines, and about 50 different functions.Is there an easy way to "rewrite" this to take advantage of classes and objects?

View 5 Replies

Make Classes/Modules/arrays And Objects?

May 18, 2010

This probably sounds daft, but im struggling to get to grips with Classes/Modules/arrays and objects, as well as there uses and what they are, and yes im still coding some how i hear you cry.The reason i ask is because Ive got a load of Dim's in my program that are the same giving locations of files and folders and wondered can they be used as a module that i can alter after the program is built, incase of folder locations being wrong or moved, manually correct after install.

View 1 Replies

What Are Classes , Objects , A Namespace , Subroutines,functions,methods,properties And Difference Between Byval And Byref

Jun 26, 2010

I want to know what are classes , objects , a namespace , subroutines,functions,methods,properties and differemce betweem byval and byref in your words.

View 18 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

C# - Whats The Point Of Tuple (Of T)

Sep 30, 2011

Possible Duplicate: What's the purpose of the Tuple(T1)/Singleton in .net?

Trying to mimic a Tuple as implemented in .Net 4 (For .Net 3) I just realized there is a Tuple(Of T)? This was quite a surprize!

Tuple<string> result = new Tuple<string>("Data");

Instead of this

return "Data";

Isn't the whole point of a tuple that its a container for "loosely related data that isnt cohesive enough to make another class"?

View 2 Replies

VS 2008 Whats The Better For Next Loop?

Mar 25, 2010

I have a question, i have worked in several languages in my life (including several versions of basic) but i wonder whether in .NET using a variable or equation in a loop is a lot slower than not using one? Take the following identical loops

Dim test(999) As Integer
For count As Integer = 0 to 999
test(count) = count
Next

[Code]...

Now the 2nd case is good because it is easier to adjust the code should the array size need to change yet my background tells me the 1st case is the one in terms of performance, test.Length - 1 is calculated each time the loop runs. a loop of the 2nd kind for example has a massive effect on java as well as VBscript or javascript.So heres the question, would test.Length - 1 be calculated each time the loop ran, or just the first time?

View 14 Replies

VS 2010 Structure Classes So That The User Interfaces Though A Single Class While The Supporting Classes Are Hidden From Their View?

Jun 13, 2012

How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:

Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()

[code].....

So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:

interface.Economic.MyMethod
interface.Currency.MyMethod
etc

This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.

View 23 Replies

VS 2010 Calling Subs And Functions Within Classes That Are Within Classes?

Oct 24, 2009

Here is some example code of what I mean:

vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click

[Code]....

View 5 Replies

Restrict Whats Pasted Into A Textbox?

Dec 28, 2010

Private Sub Recipient_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Recipient.KeyPress
If Char.IsLetter(e.KeyChar) Then[code].....

View 6 Replies

Whats Requirement Of Hardware For Sql Server

Jun 13, 2011

whats the requirement of hardware for sql server

View 1 Replies

Whats The Difference Between (As) And (=) In Object Declaration

Jun 2, 2011

if I created a new object like this Dim sqlconn As New SqlClient.SqlConnection(cs)
and Dim sqlconn = New SqlClient.SqlConnection(cs) Whats the difference?

View 1 Replies

Can't Figure Out Whats Wrong With This Two Basic Codes?

Oct 12, 2010

No errors are given in either first or second code besides theinputbox whats wrong here ?

1:)
Dim readings(-1) As integer
2:)

[code].....

View 2 Replies

Make A Combobox Display Whats In The Sql Database?

Jun 9, 2011

I'm doing a project involving VB.Net 2008 and SQL.

I'm trying to make a combobox display whats in the sql database that is connected on the left hand side.

View 5 Replies

Send Whats In Textbox1 When They Push Enter?

Apr 20, 2009

Im trying finish my Chat room and I just need to know how to make it send when they push enter so they dont have to click the button.How would I make it send Whats in textbox1 when they push enter?

View 6 Replies

VS 2010 Save Whats In Text Box To File?

Sep 30, 2010

I have a RichText area, and wanted to create a button, that will take whats in the RichText area, and come up with the prompt for the user to save somewhere on the machine..

View 1 Replies

Get Relation Between 2 Databases?

Jun 7, 2011

I have two dataset , each with with table . each datasets is connected to a separate dataadapter to get data from sql server database file (two different tables SQLtableOrders & SQLtableCustomerA))

datasetOrders.Tables("Orders") >>> the first column "orderID" is a primary unique key. Its structure is details below :
OrderID----OrderName----OrderCost--------Date
1----------A---------------54------------11/11/2010

[Code].....

note that I had already made this by getting the data by SQL Statement "Select SQLtableOrders.* , SQLtableCustomerA.orderID FROM SQLtableOrders, SQLtableCustomerA WHERE SQLtableOrders.orderID = SQLtableCustomerA.orderID" It is really working fine , but the problem that it takes time to get data from the SQL server each time I disply orders. I already have the datasetOrders.Tables("Orders") data on the client PC , I need only to make the client PC extract which orders are assinged to a ceratin customers. I can do it by For... Next , but I guess it will take time , specially if "orders" data contains many data .

View 8 Replies







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