vb.net structure default property

I am trying to use the vb.net upgrade wizard in vs5 to upgrade an old application.
But the IDE shows some errors that I don't now how to fix.

To explain further: I have a type that the wizard has converted into a structure, I have an array of that type, but I pass just the value of the array that I want to work on at that moment.
See my example:



 


Normal      UPGRADE_WARNING: Couldn't resolve default property of object tmpClient. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'      C:\Clients\Net\....\clsClientSort.vb      84

Public Structure typCliSelect
   Dim ID As String
   Dim ClientName As String
End Structure
 
Dim Aray() as typCliSelect
Redim aray(10) as typClient
 
for I = 1 to 10
  ProcessClient(Aray(i))
next
 
public function ProcessClient(MyClient as typCliSelect) as long
' Do some stuff ...
end function

Open in new window

sidwelleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

prashantagarw10Commented:
You have two options but u will need to explore a bit on each of these to see which one suits you better

1. Define an indexer on class. this will behave like a default property. Search on google for dotnet class indexer and you shd. see some relevant info.

2. Define a class's default property just above the class declaration like :
<DefaultProperty("MyProperty")> _
Public Class typCliSelect
    ...
    Public Property MyProperty() As String
        ...
    End Property
    ...
End Class

Do not use the default keyword within property itself.

this should solve your problem.

Cheers!
Prashant
0
sidwelleAuthor Commented:
Not sure, I don't really care about the default property.
I want to pass 1 component of the array, not one property of the structure/type.
I want to pass the whole structure.
0
sidwelleAuthor Commented:
From what I have read, the correct way to assign one user defined structure to another is exactly as I di
it:
Dim A as MyStruct
Dim B as MyStruct
A = B
Its just the conversion wizard that throws an error, right ?

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

prashantagarw10Commented:
yes your code is right and thats y i was wondering what your question actually is.
i thought you were asking a work around for the error thrown by conversion wizard so what i had told was a resolution to that. otherwise your code looks fine. Even though you might need to defien a default property if you have used it some where in your code so there my answer will help you.

Cheers!
Prashant
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ArkCommented:
1. Not sure, but VB.net default declaration is ByVal while vb6 is ByRef.
Probably
public function ProcessClient(ByRef MyClient as typCliSelect) as long 'integer?
do the trick?
2. Try use Classes instead of structures with explicit 'New' keyword
Public Class typCliSelect
   Dim ID As String
   Dim ClientName As String
'Public Sub New()
'Initialize some properties
'End Sub
End Class
Dim Aray() as typCliSelect
Redim aray(10) as typClient
 
for I = 1 to 10
  Aray(i)=New typClient
  ProcessClient(Aray(i))
next
0
sidwelleAuthor Commented:
thanks for the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.