473,379 Members | 1,257 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,379 software developers and data experts.

Holding a reference

I'm having trouble with references. Specificly i want to maintain a
reference to a string. So that after I pass it to the constructor, other
methods can have at it. I can do this is C/C++, but I can't seem to make
it work in VB.
In the constructor I have

Me.Value = value ' where value was pass ByRef, and
' Me.Value was declared global As String.

when i return to where the func was called, the string put in is not
there.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 22 '06 #1
3 1000
It doesn't look like you are trying to change the value of the external
string. All it seems you are doing is setting the initial value of the
Value property of the class instance that your code is wrapped inside of.
When you return to your function, your original string should still be
there, as nothing has attempted to change it.

Please show us the code that is calling the code below and show the whole
constructor code as well.

"Dagoberto Aceves" <da*****@devdex.com> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
I'm having trouble with references. Specificly i want to maintain a
reference to a string. So that after I pass it to the constructor, other
methods can have at it. I can do this is C/C++, but I can't seem to make
it work in VB.
In the constructor I have

Me.Value = value ' where value was pass ByRef, and
' Me.Value was declared global As String.

when i return to where the func was called, the string put in is not
there.

*** Sent via Developersdex http://www.developersdex.com ***

Feb 22 '06 #2
The function calling the new form goes like this.

...
Dim getResult As String
f = New SingleItemListEdit(type, True, getResult)

...

' In constructor

Public Sub New(ByVal thisList As List_Editor, ByVal setDialog As
Boolean, ByRef value As String)
...
Me.value = value ' A way to communicate back to the calling form

' In global
Public value As String

' Other function use the Me.value

*** Sent via Developersdex http://www.developersdex.com ***
Feb 22 '06 #3
Dagoberto,

You are passing a pointer to a pointer which points to Nothing, what is the
sense of that.

Cor
Feb 23 '06 #4

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

Similar topics

0
by: Ramesh K | last post by:
Hi All, To debug a C++ program running under DLLHOST, i am attaching to the DLLHOST process..even after detaching, dbgproxy.exe is holding a file reference(HANDLE) to the C++ COM component. So...
1
by: moggous phar | last post by:
how i have to declarate stuff like this: typedef struct { PfadIter Parent; CString Name; } PFADSTRUCT; typedef PfadMapType::iterator PfadIter; typedef std::map<PFADSTRUCT, int> ...
27
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get...
0
by: Ramesh K | last post by:
Hi All, To debug a C++ program running under DLLHOST, i am attaching to the DLLHOST process..even after detaching, dbgproxy.exe is holding a file reference(HANDLE) to the C++ COM component. So...
1
by: Martin | last post by:
Hi, I've got a base/super class with just a default constructor. I want another constructor, but I can't modify the base class, so I created a sub class with a constructor like so: public...
3
by: Adam | last post by:
I can't seem to find one spot on the net that specifies exactly what I need to do. Situation: Native dll needs to hold a static reference to a managed class in .net 2.0 (whidbey) which needs to...
2
by: I appreciate your help.... anony | last post by:
Hi, does anyone know whether it is possible to have a holding page for when an application domain dies and give the "503" error, we would like to replace that error a holding page. Can some one...
6
by: Stephen Costanzo | last post by:
In the code below I receive an exception error because the target file is being used by another process. I know this to be false because the target doesn't exist. It seems like the application...
4
by: Nalaka | last post by:
Hi, I have some request specific data that gets created in a "early event", that I need to pass around to many other events. I need access to this data during that request. (and more importantly...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.