Something Like Operator Overloading For Only Part Of An Objects Properties?

Aug 21, 2009

For good reasons I would like to have something like truckA = truckB + truckC where only the loads of the trucks are added, not the license plate numbers. Also I don't really want to return a new object (lots of overhead), just change one or two of the properties. Only thing I can come up with is truckA.Load = truckB.Load + truckC.Load, or at best truckA.Load = truckB + truckC which still doesn't look elegant, and - worse - still requires the creation of a new Load object.(this is just a way of stating my problem; the real objects are quite big and complicated) Currently I have a Sub isSumOf so the code reads TruckA.isSumOf(truckB, TruckC)

View 4 Replies


ADVERTISEMENT

Consider Operator Overloading In .net?

Sep 9, 2009

What scenarios would you consider operator overloading in .net?

View 5 Replies

Overloading Assignment Operator?

Jan 9, 2010

i would like to hijack the assignment operator and do some customization before an instance of my class is assigned.

example:
Dim A as New MyClass
Dim B as MyClass = A

i want custom the behavior of = is that possible?

View 9 Replies

Operator Overloading In Getting Some Kind Of Compatibility?

Jul 15, 2010

I'm working together with someone on a project, but I'm writing code in VB.Net, and hes coding in VC++. I'm trying to get some kind of compatability going on, so I'm putting my support classes into a VB dll. I've tested it a little, and it seems that all of the functions work, but the operator overloading that I did in VB doesnt seem to carry over to C++.

View 2 Replies

Asp.net - Overloading Enums And Properties In .NET?

Sep 23, 2010

I have a base class with the the following enum and property:

[Code]...

First off, how do I do this - is it by simply overloading it? And secondly will my original property pick up the new enum automatically when using the derived class or will I need to overload that too?

View 2 Replies

Modifying Objects Inside For Each Loop Sets Properties Of All Objects With Values Of Last One?

Jan 29, 2011

I have a program like this.

Module Module1

Public Class Mstr
Public Property Prop1 As String
Public Property Prop2 As String[code]....

But it is not working as I expect it to. You can see it from.The DtlsB properties of all three DtlsA objects are having values from last iteration.

View 1 Replies

Office Automation :: Columns As Objects Part - Removing Duplicates

Nov 28, 2009

I am Tring to Make this work but I do not understand the Colunms as objects Part. Here is what I got

[Code]...

View 3 Replies

Copy Properties Of Objects

Dec 28, 2009

MustInherit Class Z
Public Property Name() As String
Get
Return strName

[Code]...

' What I am looking here is, I wanted to copy all the (inherited object properties of class Z is common for both A & B) common property values of object A into object B without accessing properties independently eg: objB.Name = objA.Name (Don't want to do like this)

End Sub
End Class

View 1 Replies

Access Objects / Properties In An Application From Another DLL

Jan 31, 2006

I have an application which is grouped in a MainApplication and serveral Modules (DLL's) The Main Application is basicly a Form with a NavigationBar on the Left Side (like in Outlook 2003) and an MDI-Parent. There is also a Simple Login Routine on this Form. I store the UserName after Loggingn to a Property. The DLL's holds functionallity and Forms for various Sections for example there is a Employee.dll which holds functions and a form to show all Employees.

On Loading of the Main Application I loop trough all dll's in a "Module"-Folder and extract NavigationItems from them which I add to the MainForms NavigationPanel. I don't have a reference to the Modules because I want to make it as flexible as possible so that it is possible to delete a Dll form the Module directory in order to remove the functionality from the MainApplication. The Modules could work also without the MainApplication if they are Complied as an exe insted of DLL of course. This works fine so far.

[Code]...

View 2 Replies

Compare Specific Properties Within Two Objects?

Sep 14, 2010

I am trying to compare specific properties within two objects. Example:I want to compare the Last Name, Age, and Sex of two people (Person1 and Person2).

View 3 Replies

How To Call Multiple Objects With Same Properties

Apr 15, 2011

How can I call multiple objects? Example..
nameTextbox.Enabled
addressTextbox.Enabled
ContactTextbox.Enabled
How can I call this objects with same properties...

So rather than typing them all with =True or False...
I just have to type a variable = True or false...
And where will I type the code.

View 9 Replies

IDE :: Any Way To Change Default Properties For Different Objects?

Mar 8, 2012

Is it possible to change the default properties for different objects in the VB6 IDE (I'm sure any version would be similar, but this is the one we are currently using in my programming class in school). For example, is there anyway that automatically, when I create a Label, that it could already have AutoSize set to false, and BorderStyle to Fixed3D, etc.? I feel as if it would work greatly with the amount of time taken to layout my programs.

View 5 Replies

Storing Objects As Properties And Then Accessing Them?

Jan 28, 2011

I want to know the correct way to access an object that is stored as an object in another object...phew. Here is what I'm trying to do...

I'm creating a restaurant map and to keep things simple I have 3 classes -- cServer, cTable and cGuest. cTable has a property which should contain a cServer object eg

Public Property Server() As Object
'Called when the property is read
Get

[Code].....

View 2 Replies

VS 2010 Custom Objects And Properties

Nov 13, 2011

I'm working on a project where I need to information on all the monitors connected to a computer and then write a configuration file based on that. I can already get the screen information by creating a new instance of screen and reading the information such as index, bounds and everything else.I'm trying to create a virtual screen object to hold the information from the screen so I can work with it, or add other properties to it.[code]This all works perfectly how I want it to. Except I would like to do one more thing. How can I make it so that instead of getting Virtual_Screen.Top, I could get Virtual_Screen.Bounds.Top? That way I could create other properties such as Virtual_Screen.Border.Top..I have no idea how to code, or what that would be called. It's hard to search for something you don't know the name of.

View 5 Replies

Changing Datatypes Of Properties Of Serialized Objects?

Jun 18, 2009

Changing datatypes of properties of serialized objects?

View 1 Replies

Creating Get/Set Properties For Interfaces And Using Them In Mock Objects?

Jan 19, 2009

I am having trouble assigning values to the properties defined in the mock objects.

Public Interface IAddCustomerView
Property FirstName() As String
Property LastName() As String
Property Message() As String
End Interface

My unit test below always fails saying that getMessage was never called:

<Test()> _
Public Sub Should_Display_A_Success_Message()
_presenter = New AddCustomerPresenter(_view, _repositoryStub)

[code]....

View 1 Replies

Sorting Objects In Arraylist By One Of The Object's Properties?

Aug 30, 2011

I have a group of objects stored in an arraylist. These custom type objects have a number of properties from their underlying class . I want to use one of the properties to sort the array. I cannot determine which Array.Sort method to use.

I want to sort based on an integer property. Virtually every example I can find involves sorting strings.

So, assume the Objects have the following properties.

Obj.name as string
Obj.ID as integer
Obj.Alive as boolean

The objects are kept in an arraylist called FriendsOfMine.

I want to be able to order the list by Obj.ID, both ascending and descending in value.

View 12 Replies

Starting Properties Of Objects In Winforms Form?

Jun 11, 2012

In my software course, each time we submit an assignment, we have to include a document with the starting properties of each object in a form.

E.g.

TextBox1
Location: 241, 115
Name: TextBox1
Size: 100, 20
TabIndex: 0

It's a real pain to scroll through the properties viewer and copy and paste each customised value for 30+ objects on a form... I was wondering if there'd be an easy piece of code or way about getting an (at least partially) automated printout/view of all the properties of the objects.

Was thinking some sort of private sub I could past into the bottom of the program and run on load, that gets all objects, and outputs the non-default properties to a report or something?

View 1 Replies

Accessing Hidden Properties Of Excel 2007 VBa Objects

Jun 22, 2009

I need to migrate from Excel 2003 VBA to Excel 2007 VBA. When Microsoft introduced Excel 2007 it removed many objects from the previous versions and added some new objects. Also it hid some properties of particular objects. These hidden properties can be viewed by going to the object browser, right clicking any object and selecting "Show Hidden Members". My problem is I need to access these hidden properties. Is there any way I can access these properties. I can successfully migrate from Excel 2003 VBa to Excel 2007 VBA with the same functionality?

View 5 Replies

Get 'memberOf' Properties For Computer Objects In Active Directory

Jul 28, 2011

I apologize if this is the wrong forum. I'm searching for all computer objects in an OU in Active Directory. I'm able to get the computer name, DN, and description but cannot get the memberOf properties. I'm wanting to get all groups the computer is a member of. My code is below:

[Code]...

View 2 Replies

Showing Properties Of Child Objects In The Property Grid?

Mar 9, 2010

I have a custom class (Class1) with a bunch of properties. One of the properties of this class is another custom class (Class2) with its own properties.I have a property grid with the selected object set to Class 1. I can see Class 2 as a property, but i would like to expand Class 2 to show its properties in the same property grid.

Im basically trying to do the exact same thing as the Font Class on a form. If you look at the properties of a form in the designer, you can see the font property. You can then expand that to show the properties of the font class.

View 1 Replies

Implementation - Loop To Update Properties Of Each Object Of A Set Of Custom Objects

Jan 4, 2010

I am using a loop to update properties of each object of a set of custom objects. The routine knows which controls to update because the controls value is not empty, I don't want the routine setting the corresponding properties to nothing when the control is empty. Now I know how to do this perfectly fine with IF statements such as:

CODE:

But this feels really redundant doing that same IF block over and over for each property/control combination, I thought about creating a separate routine that takes the control as an argument and does all the repetitive IF blocks but I don't know how I could also pass an object property to tell the routine to update that particular property.

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

Error: Option Strict On Disallows Operands Of Type Object For Operator '='. Use The 'Is' Operator To Test For Object Identity

Jan 27, 2010

I am tightening up my coding with the Option Strict set to ON. It has now produced alot of errors. An example of this is:

If AllocatedDGV.Rows(i).Cells("RoomNumber").Value = RoomsAvailableDGV.Rows(j).Cells("RoomName").Value Then

It gives me the following error: Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for object identity.

View 6 Replies

Get An Error Overloading Sub New()

Nov 20, 2009

I have a module with code that refers to controls on form1 form1.textbox1.text 'after adding the sub new overload below to my form my module gives me "reference to a non shared member requires an object reference" why is that? [code]

View 9 Replies

Get An Error Overloading Sub New()?

Jul 28, 2011

passing a variable to another formI have a module with code that refers to controls on form1form1.textbox1.text 'after adding the sub new overload below to my form my module gives me "reference to a non shared member requires an object reference"

View 2 Replies

Option Strict On Disallows Operands Of Type Object For Operator Use The 'Is' Operator To Test For Object Identity

Apr 6, 2012

I need to write an interface to get data to/from our data files.

We have a low level class that holds field values for each record read from the files.

This just holds two values, the value read from the file (DBValue) and the updated value that may need to be written back to the file (CurrentValue).

These values may be any of the standard value types (integer, date etc) or a string.

Either value (DBValue or CurrentValue) may be null if not defined.

I have written the class to manage this data which works fine while option strict is NOT on.

But we have an office policy of having option strict on all the time.

When I put option strict on, my object value comparisons fail with the error: "Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for object identity."

Question, how should I change the following code to handle option strict on ...

This is all running on Visual Studio 2010

[Code]...

View 1 Replies

Coalesce Operator And Conditional Operator In .NET?

Mar 10, 2009

Possible Duplicate: Is there a conditional ternary operator in VB.NET?

Can we use Coalesce operator(??) and conditional ternary operator(:) in VB.NET as in C#?

View 5 Replies

Multi Form / Part Application Need To Make Part Protable For Transfer

Feb 22, 2011

im making an application in vb.net (duh!) anyway i have created and coded the whole project and it performs exactly as i want it to (i dont need code help). my problem lies with the fact that my project is 2-3 parts

1.a setup form that gathers inital data about the enviroment stores this data encrypted in a config file. after inital setup this form is not displayed again. but needs to be run on both computers

2. the second form is the real application form im in the process of turning this part in to a background service anyway this form is the one that establishes the connection between two nodes it works correctly

3. the config files

anyway here is my problem i want to make this application distributional with just one file the (.exe) and have this .exe make everything else happen. it runs the setup form and creates the first config file which it does then it needs to produce a copy of just the second form and the config file to transfer to workstation #2 that will run independtly without the whole application which i cant make happen then it needs to turn both workstations application on by only starting one on either computer and invoke the other computer to start its corrosponding app also no idea how to make this happen any ideas or suggestions as to where to look to try to find my answers.im thinking i might need to make two seperate applications (a setup app, and the running app) and include them both in a project and use the setup.exe to to package them together this is a little side project that im making for my self to use to make programming a little easier so i plan on giving it out to some fellow students to test and tell me what they think so im not really worried about ease of use or complicated procedures yet but if it turns out to work and actually be of use to anyone else i would be willing to rewrite it to distribute to the masses but for now i just want it to work for me.

View 4 Replies

Overloading A Property's Set Method?

May 12, 2012

maybe it's not a method exactly. here's what I'd like to do:

Private _Columns As ArrayList
Public Property Columns() As ArrayList
Get[code]....

which would allow me to conveniently set the property by assigning to it various kinds of collection types... except, I can't do it because apparently the Set method has to take an argument of the type of the property itself... I get the complaint:

'Set' parameter must have the same type as the containing property

is there a way to do this?

View 2 Replies







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