[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] VB referencing issue?



On Mon, Nov 06, 2006 at 08:41:47PM +1100, John Elliot wrote:
> On Monday 06 November 2006 19:17, Thomas Given-Wilson wrote:
> > I am having a problem with some VB code 
> 
> VB6?
> 
> > dim c as ClassC
> > c = New ClassC
> 
> set c = new ClassC

VB.NET... I have tried:

Returning c from a function.
Passing a ClassC 'ByRef' and 'ByVal' and then operating on it.
Passing a ClassC reference and returning a new ClassC on that reference ('ByRef' and 'ByVal').
Passing an ArrayList and putting the ClassC in the ArrayList (works for other classes in my program).
Calling all of the various functions/subs from a seperate sub to the one checking c.value.

I almost had it working for a moment with:
Function getC() as ClassC
Dim c as ClassC
c = New ClassC
c.value = 1
'But then I did something stupid, I put in an If statement:
If c.value > 0
    c.value = 2
    Return c
End If
Return C
End Function
'This also returns c.value = 100, but if I do:
Sub getC(ByRef c as ClassC)
c = New ClassC
c.value = 1
Return
End Sub
'It works... but now I can't actually do what I need to as I can't change c.value depending on what I want...


...

I hate VB.NET, don't get me started on other aspects of it.


SanguineV


-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@xxxxxxxxxxxxxxxxxxx
If you are having trouble, ask owner-progsoc@xxxxxxxxxxxxxxxxxx for help.