|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
structures in VB.Netapplication. 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
Show quote
Hide quote
"sid" <sidwe***@alexian.net> wrote in message First thing is to turn on Strict on. This will give you better info on your 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 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
Show quote
Hide quote
On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote: Thank you for the imput, but that dose not help me solve my problem.> "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 - What I want to know is how to pass 1 element of an array to a function. Thanks On 2009-07-02, sid <sidwe***@alexian.net> wrote:
Show quoteHide quote > On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote: You simply do what you always did:>> "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 > Dim ar(9) As Integer S(ar(0)) Public Sub S(ByVal i As Integer) .... End Sub -- Tom Shelton 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 < 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 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 > On 2009-07-03, Michel Posseth [MCP] <m***@posseth.com> wrote:
> VB.NET is just zero indexed. VB.CLASSIC can be 1 or 0 - depending on Option Base> 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 :) -- Tom Shelton 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 >> > On Jul 2, 11:31 am, "Lloyd Sheen" <a...@b.c> wrote: No, his array is 0 to 10, so iterating from 1 to 10 will work,> "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. 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 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: The UDT "typClient" and "typCliSelect" was a typo, it was all> > > "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 - 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.
Other interesting topics
vb.net and Ms SQL Connection ?
Using "Me" Using WPF with a "normal" windows app Unable to connect to the remote server How to reference class properties using MyClass("PropertyName") VB Net/Com Interoperability/Late Binding Serializing Custom Generic Collection (Of InterfaceType) DataGridView Event Web server is not running ASP.NET version 1.1. Add Line Break to mail body |
|||||||||||||||||||||||