Bonjour.
N'y aurait-il pas depuis la VB8 un moyen d'assigner en une seule instruction
l'ensemble des propriétés d'un objet aux propriétés de mêmes noms d'un autre
objet, plutôt que d'écrire la liste fastidieuse :
O2.P1 = O1.P1
O2.P2 = O1.P2
O3.P2 = O1.P3
etc.
Une sorte de MOVE CORRESPONDING en COBOL en quelque sorte.
Il me semble avoir entendu parler de quelque chose de semblable lors d'une
présentation de LINQ, mais le souvenir est trop vague.
Merci de votre aide,
Gilbert 10 1188
On Aug 29, 9:19*am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
Bonjour.
N'y aurait-il pas depuis la VB8 un moyen d'assigner en une seule instruction
l'ensemble des propriétés d'un objet aux propriétés de mêmes noms d'un autre
objet, plutôt que d'écrire la liste fastidieuse :
O2.P1 = O1.P1
O2.P2 = O1.P2
O3.P2 = O1.P3
etc.
Une sorte de MOVE CORRESPONDING en COBOL en quelque sorte.
Il me semble avoir entendu parler de quelque chose de semblable lors d'une
présentation de LINQ, mais le souvenir est trop vague.
Merci de votre aide,
Gilbert
English please?
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Sorry, in English :
Hello,
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another object,
instead of coding number of trivial lines like
O2.P1 = O1.P1
O2.P2 = O1.P2
O2.P3 = O1.P3
etc.
Something like a MOVE CORRESPONDING in COBOL.
I think I have heard somethink like this in a LINQ meeting sometime ago, but
I do not remember. Thank you for your help.
Gilbert
On Aug 29, 9:38*am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
Sorry, in English :
Hello,
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another object,
instead of coding number of trivial lines like
O2.P1 = O1.P1
O2.P2 = O1.P2
O2.P3 = O1.P3
etc.
Something like a MOVE CORRESPONDING in COBOL.
I think I have heard somethink like this in a LINQ meeting sometime ago, but
I do not remember. Thank you for your help.
Gilbert
I don't think there is a built in method (I could be wrong).
Once upon a time I wrote a piece using Reflection that did this, but
I'm not sure where that code is. Basically you do a GetProperties on
the source class and then you attempt to do a set value for each of
the properties in the destination class, not the cleanest solution,
but it works.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
OK, I think I can do that.
Thank you,
Gilbert
"rowe_newsgroup s" <ro********@yah oo.coma écrit dans le message de news: b7************* *************** **...legroup s.com...
On Aug 29, 9:38 am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
Sorry, in English :
Hello,
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another object,
instead of coding number of trivial lines like
O2.P1 = O1.P1
O2.P2 = O1.P2
O2.P3 = O1.P3
etc.
Something like a MOVE CORRESPONDING in COBOL.
I think I have heard somethink like this in a LINQ meeting sometime ago,
but
I do not remember. Thank you for your help.
Gilbert
I don't think there is a built in method (I could be wrong).
Once upon a time I wrote a piece using Reflection that did this, but
I'm not sure where that code is. Basically you do a GetProperties on
the source class and then you attempt to do a set value for each of
the properties in the destination class, not the cleanest solution,
but it works.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
On Aug 29, 10:05*am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
OK, I think I can do that.
Thank you,
Gilbert
"rowe_newsgroup s" <rowe_em...@yah oo.coma écrit dans le message de news:
b736454f-7fbb-420d-b62e-432caf702...@k3 0g2000hse.googl egroups.com...
On Aug 29, 9:38 am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
Sorry, in English :
Hello,
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another object,
instead of coding number of trivial lines like
O2.P1 = O1.P1
O2.P2 = O1.P2
O2.P3 = O1.P3
etc.
Something like a MOVE CORRESPONDING in COBOL.
I think I have heard somethink like this in a LINQ meeting sometime ago,
but
I do not remember. Thank you for your help.
Gilbert
I don't think there is a built in method (I could be wrong).
Once upon a time I wrote a piece using Reflection that did this, but
I'm not sure where that code is. Basically you do a GetProperties on
the source class and then you attempt to do a set value for each of
the properties in the destination class, not the cleanest solution,
but it works.
Thanks,
Seth Rowe [MVP]http://sethrowe.blogsp ot.com/
I just threw some code onto my blog that should do this. As a warning
it's completely untested! http://sethrowe.blogspot.com/2008/08...ing-class.html
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Gilbert Tordeur wrote:
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another
object, instead of coding number of trivial lines like
>O2.P1 = O1.P1 O2.P2 = O1.P2 O2.P3 = O1.P3 etc.
I could be getting the wrong idea, but isn't that what .Clone is for?
Andrew
On Aug 29, 10:33*am, "Andrew Morton" <a...@in-press.co.uk.inv alid>
wrote:
Gilbert Tordeur wrote:
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another
object, instead of coding number of trivial lines like
O2.P1 = O1.P1
O2.P2 = O1.P2
O2.P3 = O1.P3
etc.
I could be getting the wrong idea, but isn't that what .Clone is for?
Andrew
Clone doesn't work if you want to change class types (which is what I
took as what the OP was looking for). It also will only work with the
class implements ICloneable.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Andrew,
I think .Clone is for the same class, but if you copy to an object of
another class ?
Regards,
Gilbert
"Andrew Morton" <ak*@in-press.co.uk.inv alida écrit dans le message de
news: 6h************@ mid.individual. net...
Gilbert Tordeur wrote:
>Is there a way since VB2008 to assign with only one statement all the properties of an object to the (same name) properties of another object, instead of coding number of trivial lines like
>>O2.P1 = O1.P1 O2.P2 = O1.P2 O2.P3 = O1.P3 etc.
I could be getting the wrong idea, but isn't that what .Clone is for?
Andrew
OK, I got it. I will try and let you know.
Regards,
Gilbert
"rowe_newsgroup s" <ro********@yah oo.coma écrit dans le message de news: c5************* *************** **...legroups .com...
On Aug 29, 10:05 am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
OK, I think I can do that.
Thank you,
Gilbert
"rowe_newsgroup s" <rowe_em...@yah oo.coma écrit dans le message de news:
b736454f-7fbb-420d-b62e-432caf702...@k3 0g2000hse.googl egroups.com...
On Aug 29, 9:38 am, "Gilbert Tordeur" <gilbert.tord.. .@orange.fr>
wrote:
Sorry, in English :
Hello,
Is there a way since VB2008 to assign with only one statement all the
properties of an object to the (same name) properties of another object,
instead of coding number of trivial lines like
O2.P1 = O1.P1
O2.P2 = O1.P2
O2.P3 = O1.P3
etc.
Something like a MOVE CORRESPONDING in COBOL.
I think I have heard somethink like this in a LINQ meeting sometime ago,
but
I do not remember. Thank you for your help.
Gilbert
I don't think there is a built in method (I could be wrong).
Once upon a time I wrote a piece using Reflection that did this, but
I'm not sure where that code is. Basically you do a GetProperties on
the source class and then you attempt to do a set value for each of
the properties in the destination class, not the cleanest solution,
but it works.
Thanks,
Seth Rowe [MVP]http://sethrowe.blogsp ot.com/
I just threw some code onto my blog that should do this. As a warning
it's completely untested! http://sethrowe.blogspot.com/2008/08...ing-class.html
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Arthur Dent |
last post by:
Does anyone know where i can find a decently thorough list of the language
changes in VB2008, such as the new If() function?
All i can seem to find through search engines, most of the articles all talk
about LINQ, with only cursory mention - at best - of any other new features.
Thanks in advance, ...
Arthur Dent.
|
by: Arthur Dent |
last post by:
I am trying to make a VB2008 Express winforms project, and edit the form.
However, when i try to open the form, i get this error:
..NET Framework 2.0 update not found. The win32manifest will not be embedded.
It considers it a fatal error, and will not let me edit the form, either in
code or design view.
I have frameworks 1.1, 2.0, 3.5 installed, and all Windows Updates (sans
DreamScene).
|
by: Academia |
last post by:
I have a computer at home with a (slow) dialup connection and a computer at
school with a fast connection.
I want to go there (it is not close) and down load Vb2008 express, burn it
into a CD, bring it home and install it on my home computer.
Someone told me it can't be done.
Is there a way of doing that?
|
by: Galen Somerville |
last post by:
My graphics involves a lot of line drawings in a short period of time. I
have all the graphics in a separate module.
I repeatedly get the pixel data from a USB device, draw the requisite
traces, get more data, draw traces, etc.
The USB appears to take 82 ms between bursts of data. But the drawing is
taking 178 ms !!!
It's a real time display, like an oscilloscope, whereby I have to blank the
|
by: Scott Gravenhorst |
last post by:
Windows XP SP3
My application is set to open a SaveFile dialog when an exit is
requested. When I click the app's close button, the save dialog
opens, but when I click to change the folder, the exception occurs
pointing to FileSaveDialog1.ShowDialog(). The exception also
indicates some problem with system.drawing.dll.
The exception text is:
"Attempted to read or write protected memory. This is often an
| |
by: MichaelH |
last post by:
Are there any definite advantages of VB2008 over VB2005?
Thank in advance.
Michael
|
by: John Whitworth |
last post by:
Hi,
I'm rewriting an old VB6 app of mine in VB2008. All has been going well with
calls to winscard.dll, until I needed to send an array of bytes as part of a
structure. When using a winscard trace, I can see that the bytes in the
array suddenly become nonsense, whereas I know that what I called the DLL
with was good.
I think I need to do something along the lines of MarshalAs, but I haven't
the first clue where to start. Any...
|
by: John Dann |
last post by:
Looking to migrate from VB2005 Pro to VB2008. Can anyone
suggest/recommend a VB2008 book that highlights the changes from
earlier versions of VB.Net (VB2003/2005) rather than describing VB2008
totally from scratch? I suspect that this may be asking too much in
that few books will focus exclusively on migrating/upgrading, but
there still may be something out there that is written with existing
users of VB.Net in mind. I'm obviously looking...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |