Home All Groups Group Topic Archive Search About
Author
2 Jul 2009 3:42 PM
sid
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.

The wizard though an error:
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

but I am not concerned with the default property, I just want to pass
the element of the Array.  In VS I get the previous error at the first
line of the function. This is what use to work well in VB6.

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


How do I pass just one element of the array ?
Thanks

Author
2 Jul 2009 4:31 PM
Lloyd Sheen
Show quote Hide quote
"sid" <sidwe***@alexian.net> wrote in message
news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>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.
>
> The wizard though an error:
> 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
>
> but I am not concerned with the default property, I just want to pass
> the element of the Array.  In VS I get the previous error at the first
> line of the function. This is what use to work well in VB6.
>
> 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
>
>
> How do I pass just one element of the array ?
> Thanks

First thing is to turn on Strict on.  This will give you better info on your
code and in the long run "force" you to write better code before testing.

Second is the Redim statement.  It does not use the "as typClient".  This
should show as a compile error.

Next since you are using an array it's elements are from 0 to 9 in your
example.  Your code from 1 to 10 will not work.

If you are using VS 2005 and up you should change this to use Generics.
This will give you better checking while typing and in the long run will
execute quicker.

Hope this helps
LS
Are all your drivers up to date? click for free checkup

Author
2 Jul 2009 5:40 PM
sid
Show quote Hide quote
On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote:
> "sid" <sidwe***@alexian.net> wrote in message
>
> news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>
>
>
>
>
> >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.
>
> > The wizard though an error:
> > 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
>
> > but I am not concerned with the default property, I just want to pass
> > the element of the Array.  In VS I get the previous error at the first
> > line of the function. This is what use to work well in VB6.
>
> > 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
>
> > How do I pass just one element of the array ?
> > Thanks
>
> First thing is to turn on Strict on.  This will give you better info on your
> code and in the long run "force" you to write better code before testing.
>
> Second is the Redim statement.  It does not use the "as typClient".  This
> should show as a compile error.
>
> Next since you are using an array it's elements are from 0 to 9 in your
> example.  Your code from 1 to 10 will not work.
>
> If you are using VS 2005 and up you should change this to use Generics.
> This will give you better checking while typing and in the long run will
> execute quicker.
>
> Hope this helps
> LS- Hide quoted text -
>
> - Show quoted text -

Thank you for the imput, but that dose not help me solve my problem.
What I want to know is how to pass 1 element of an array to a
function.
Thanks
Author
2 Jul 2009 6:00 PM
Tom Shelton
On 2009-07-02, sid <sidwe***@alexian.net> wrote:
Show quoteHide quote
> On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote:
>> "sid" <sidwe***@alexian.net> wrote in message
>>
>> news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>>
>>
>>
>>
>>
>> >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.
>>
>> > The wizard though an error:
>> > 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
>>
>> > but I am not concerned with the default property, I just want to pass
>> > the element of the Array.  In VS I get the previous error at the first
>> > line of the function. This is what use to work well in VB6.
>>
>> > 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
>>
>> > How do I pass just one element of the array ?
>> > Thanks
>>
>> First thing is to turn on Strict on.  This will give you better info on your
>> code and in the long run "force" you to write better code before testing.
>>
>> Second is the Redim statement.  It does not use the "as typClient".  This
>> should show as a compile error.
>>
>> Next since you are using an array it's elements are from 0 to 9 in your
>> example.  Your code from 1 to 10 will not work.
>>
>> If you are using VS 2005 and up you should change this to use Generics.
>> This will give you better checking while typing and in the long run will
>> execute quicker.
>>
>> Hope this helps
>> LS- Hide quoted text -
>>
>> - Show quoted text -
>
> Thank you for the imput, but that dose not help me solve my problem.
> What I want to know is how to pass 1 element of an array to a
> function.
> Thanks
>

You simply do what you always did:

Dim ar(9) As Integer
S(ar(0))

Public Sub S(ByVal i As Integer)
    ....
End Sub

--
Tom Shelton
Author
2 Jul 2009 11:00 PM
James Hahn
I can't see from your sample what tmpClient is, but it may be that the error
is occurring at the first line of code in the function - the line you have
provided as 'Do some stuff'.  The error message usually indicates that you
have referred to a structure when you intended to refer to an element of the
structure.

Your code appears OK for passing the i'th element of the array to the
function. The errror may be the result of confusion in the conversion
process following the attempt to redim the array as a different type.

Show quoteHide quote
"sid" <sidwe***@alexian.net> wrote in message
news:e0f307c8-2195-47a6-8021-619b9bfca0b4@r33g2000yqn.googlegroups.com...
On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote:
> "sid" <sidwe***@alexian.net> wrote in message
>
> news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>
> >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.
>
> > The wizard though an error:
> > 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
>
> > but I am not concerned with the default property, I just want to pass
> > the element of the Array. In VS I get the previous error at the first
> > line of the function. This is what use to work well in VB6.
>
> > 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
>
> > How do I pass just one element of the array ?
> > Thanks
>
>  snip  <
Author
3 Jul 2009 4:06 AM
Cor Ligthert[MVP]
Lloyd,

An array in VB is 0 to 9 and 1 to 10 as it is declared as x(10), this is
simply because in VB an array holds one item more because of backwards
compatibility

Cor

Show quoteHide quote
"Lloyd Sheen" <a@b.c> wrote in message
news:u1XpDKz%23JHA.1252@TK2MSFTNGP04.phx.gbl...
>
> "sid" <sidwe***@alexian.net> wrote in message
> news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>>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.
>>
>> The wizard though an error:
>> 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
>>
>> but I am not concerned with the default property, I just want to pass
>> the element of the Array.  In VS I get the previous error at the first
>> line of the function. This is what use to work well in VB6.
>>
>> 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
>>
>>
>> How do I pass just one element of the array ?
>> Thanks
>
> First thing is to turn on Strict on.  This will give you better info on
> your code and in the long run "force" you to write better code before
> testing.
>
> Second is the Redim statement.  It does not use the "as typClient".  This
> should show as a compile error.
>
> Next since you are using an array it's elements are from 0 to 9 in your
> example.  Your code from 1 to 10 will not work.
>
> If you are using VS 2005 and up you should change this to use Generics.
> This will give you better checking while typing and in the long run will
> execute quicker.
>
> Hope this helps
> LS
Author
3 Jul 2009 5:16 AM
Michel Posseth [MCP]
Huh ?

>>An array in VB is 0 to 9 and 1 to 10 as it is declared as x(10), this is

Isn`t VB just zero  indexed  ? wich would mean that X(10) would hold eleven
elements
0, 1 ,2,3,4,5,6,7,8,9,10= 11

Michel



Show quoteHide quote
"Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> schreef in bericht
news:uzIEbO5%23JHA.3320@TK2MSFTNGP04.phx.gbl...
> Lloyd,
>
> An array in VB is 0 to 9 and 1 to 10 as it is declared as x(10), this is
> simply because in VB an array holds one item more because of backwards
> compatibility
>
> Cor
>
> "Lloyd Sheen" <a@b.c> wrote in message
> news:u1XpDKz%23JHA.1252@TK2MSFTNGP04.phx.gbl...
>>
>> "sid" <sidwe***@alexian.net> wrote in message
>> news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>>>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.
>>>
>>> The wizard though an error:
>>> 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
>>>
>>> but I am not concerned with the default property, I just want to pass
>>> the element of the Array.  In VS I get the previous error at the first
>>> line of the function. This is what use to work well in VB6.
>>>
>>> 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
>>>
>>>
>>> How do I pass just one element of the array ?
>>> Thanks
>>
>> First thing is to turn on Strict on.  This will give you better info on
>> your code and in the long run "force" you to write better code before
>> testing.
>>
>> Second is the Redim statement.  It does not use the "as typClient".  This
>> should show as a compile error.
>>
>> Next since you are using an array it's elements are from 0 to 9 in your
>> example.  Your code from 1 to 10 will not work.
>>
>> If you are using VS 2005 and up you should change this to use Generics.
>> This will give you better checking while typing and in the long run will
>> execute quicker.
>>
>> Hope this helps
>> LS
>
Author
3 Jul 2009 3:30 PM
Tom Shelton
On 2009-07-03, Michel Posseth [MCP] <m***@posseth.com> wrote:
>
> Huh ?
>
>>>An array in VB is 0 to 9 and 1 to 10 as it is declared as x(10), this is
>
> Isn`t VB just zero  indexed  ? wich would mean that X(10) would hold eleven
> elements
> 0, 1 ,2,3,4,5,6,7,8,9,10= 11
>
> Michel
>

VB.NET is just zero indexed.  VB.CLASSIC can be 1 or 0 - depending on Option Base
Show quoteHide quote
:)

--
Tom Shelton
Author
3 Jul 2009 5:06 PM
Cor Ligthert[MVP]
Right

Try this
\\\
Dim dtr(10) As DateTime
dtr(0) = Now
dtr(10) = Now.AddDays(-1)
///

Cor

Show quoteHide quote
"Michel Posseth [MCP]" <m***@posseth.com> wrote in message
news:5D7FACC3-5A51-48EF-952E-6D5549D42A11@microsoft.com...
>
> Huh ?
>
>>>An array in VB is 0 to 9 and 1 to 10 as it is declared as x(10), this is
>
> Isn`t VB just zero  indexed  ? wich would mean that X(10) would hold
> eleven elements
> 0, 1 ,2,3,4,5,6,7,8,9,10= 11
>
> Michel
>
>
>
> "Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> schreef in bericht
> news:uzIEbO5%23JHA.3320@TK2MSFTNGP04.phx.gbl...
>> Lloyd,
>>
>> An array in VB is 0 to 9 and 1 to 10 as it is declared as x(10), this is
>> simply because in VB an array holds one item more because of backwards
>> compatibility
>>
>> Cor
>>
>> "Lloyd Sheen" <a@b.c> wrote in message
>> news:u1XpDKz%23JHA.1252@TK2MSFTNGP04.phx.gbl...
>>>
>>> "sid" <sidwe***@alexian.net> wrote in message
>>> news:ffd80c05-c118-456a-b5f3-dac801928850@r25g2000vbn.googlegroups.com...
>>>>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.
>>>>
>>>> The wizard though an error:
>>>> 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
>>>>
>>>> but I am not concerned with the default property, I just want to pass
>>>> the element of the Array.  In VS I get the previous error at the first
>>>> line of the function. This is what use to work well in VB6.
>>>>
>>>> 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
>>>>
>>>>
>>>> How do I pass just one element of the array ?
>>>> Thanks
>>>
>>> First thing is to turn on Strict on.  This will give you better info on
>>> your code and in the long run "force" you to write better code before
>>> testing.
>>>
>>> Second is the Redim statement.  It does not use the "as typClient".
>>> This should show as a compile error.
>>>
>>> Next since you are using an array it's elements are from 0 to 9 in your
>>> example.  Your code from 1 to 10 will not work.
>>>
>>> If you are using VS 2005 and up you should change this to use Generics.
>>> This will give you better checking while typing and in the long run will
>>> execute quicker.
>>>
>>> Hope this helps
>>> LS
>>
>
Author
6 Jul 2009 1:11 PM
Chris
On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote:
> "sid" <sidwe***@alexian.net> wrote in message
>
> > Dim Aray() as typCliSelect
> > Redim aray(10) as typClient
>
> > for I = 1 to 10
> >  ProcessClient(Aray(i))
> > next
>
>
> Next since you are using an array it's elements are from 0 to 9 in your
> example.  Your code from 1 to 10 will not work.

No, his array is 0 to 10, so iterating from 1 to 10 will work,
although the first element is wasted.

Show quoteHide quote
>
> If you are using VS 2005 and up you should change this to use Generics.
> This will give you better checking while typing and in the long run will
> execute quicker.
>
> Hope this helps
> LS
Author
6 Jul 2009 1:29 PM
sid
On Jul 6, 8:11 am, Chris <dunaw***@gmail.com> wrote:
Show quoteHide quote
> On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote:
>
> > "sid" <sidwe***@alexian.net> wrote in message
>
> > > Dim Aray() as typCliSelect
> > > Redim aray(10) as typClient
>
> > > for I = 1 to 10
> > >  ProcessClient(Aray(i))
> > > next
>
> > Next since you are using an array it's elements are from 0 to 9 in your
> > example.  Your code from 1 to 10 will not work.
>
> No, his array is 0 to 10, so iterating from 1 to 10 will work,
> although the first element is wasted.
>
>
>
>
>
> > If you are using VS 2005 and up you should change this to use Generics.
> > This will give you better checking while typing and in the long run will
> > execute quicker.
>
> > Hope this helps
> > LS- Hide quoted text -
>
> - Show quoted text -

The UDT "typClient" and "typCliSelect" was a typo, it was all
inteneded to be "typCliSelect"
I think what I have found is that setting A = B is the correct way to
set all properties of A = B, but the wizard throws an error.  And in
this case should be ignored.
Author
3 Jul 2009 4:08 AM
Cor Ligthert[MVP]
Sid,

I did not know that it was possible in VB6 to create a new array with Redim,
but that is what you actually try to do

> Dim Aray() as typCliSelect
> Redim aray(10) as typClient
>
It are two different types

Cor

Bookmark and Share