473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Copies of objects vs. references to objects.

Hi, I'm having some trouble with Copies of objects versus references.
My problem is that I have written a printing/reporting system that
takes the DataGridView, and then changes the date-formatted cells to
string-format. This works fine, and the printing is ok, but then when
the CellFormatting event occurs (I have a special procedure to do some
special formatting), I get an exception occuring because I changed the
formatting type during the printing procedure. This has led me to
believe that my printing system is not really getting a copy of the
DataGridView, but is referring to the original object displayed on the
window. I set the datasource for the printing system like this:

Property dataSource() As DataGridView
Get
Return myDataGridView
End Get
Set(ByVal value As DataGridView)
Me.myDataGridView = value
Next
End Set
End Property

I thought that since the Set part of the property uses ByVal,
Me.myDataGridView would be a seperate copy.
How can I ensure that the local object (Me.myDataGridView) will be a
complete copy of the original on the UI, and not a reference to it?

I'm using VB.NET 2005

Thanks in advance.

Jul 20 '06 #1
1 1010
haha! It seems that posting on this group is the easiest way to fix my
own problems...

It turns out that I WAS getting a copy (not a reference) of the
original DataGridView object, BUT... that copy contained references to
the same UI controls that the original had. So both of the objects were
referring to the same UI parent object, and when I changed stuff in the
new copy, it messed up crap in the UI parent object. In the end, I had
to copy just the rows and columns to the new object... that was all the
data that I really needed.

Jul 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dan | last post by:
without stirring the pot too much -- could someone please point me to whatever documentation exists on the philosophy, semantics, and practical implications of how Python implements the...
4
by: Thomas Philips | last post by:
I want to represent an NxN matrix by a list containing N lists, each of which has N elements. Initially the elements are set to " ". For N=2, I write >>>x = *2 #assignment creates references,...
9
by: Henning Kage | last post by:
I'm using Python only for some months now and I'm wondering, whether such assignments as above are creating bitwise copies of an object or just recieve a reference. That means I wanted to know,...
1
by: Ilpo Nyyssönen | last post by:
Take an XML source: <document> <recipient> <name>John Doe</name> <email>john.doe@example.invalid</email> </recipient> <recipient> <name>Jane Doe</name>...
1
by: jsnX | last post by:
hi, i would like to make some code that operates on sets of points - does convex hulls and other operations. but it looks like i will need a lot of pointless object copies: ...
0
by: lord.zoltar | last post by:
Hi, I'm having some trouble with Copies of objects versus references. My problem is that I have written a printing/reporting system that takes the DataGridView, and then changes the date-formatted...
2
by: Veloz | last post by:
Hiya My question is whether or not you should associated related objects in your software using a scheme of id's and lookups, or wether objects should actually hold actual object references to...
3
by: mk | last post by:
Hello everyone, I'm storing functions in a dictionary (this is basically for cooking up my own fancy schmancy callback scheme, mainly for learning purpose): .... return "f2 " + arg .......
0
by: Calvin Spealman | last post by:
On Thu, Jul 17, 2008 at 7:45 AM, mk <mrkafk@gmail.comwrote: As was pointed out already, this is a basic misunderstanding of assignment, which is common with people learning Python. To your...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.