|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
converting from basic to vb6Hi
Can someone convert this code to vb6 Please data 153, 150, 102 105,102,150,153,105 for a=1 to4:read var1(a):next for a=1 to4:read var2(a):next some code for a = 1to 12 for b = 1 to 4 command, only accepts one argument, has to read 4 numbers from var1 or var2 some code next a: next b Thank you "Viper900" <Viper***@discussions.microsoft.com> wrote No doubt you'll get differing replies, but one solution would be> Hi > Can someone convert this code to vb6 Please > > data 153, 150, 102 105,102,150,153,105 > for a=1 to4:read var1(a):next > for a=1 to4:read var2(a):next > some code > for a = 1to 12 > for b = 1 to 4 > command, only accepts one argument, has to read 4 numbers from var1 or var2 > some code > next a: next b var1 = Array(153, 150, 102, 105) var2 = Array(102, 150, 153, 105) Of course dimensioning the arrays and asigning data would be the more prudent thing to do, but I leave that for you discover.... LFS Larry Serflaten wrote:
Show quoteHide quote > "Viper900" <Viper***@discussions.microsoft.com> wrote Wonder what his teacher advised? ;-)>> Hi >> Can someone convert this code to vb6 Please >> >> data 153, 150, 102 105,102,150,153,105 >> for a=1 to4:read var1(a):next >> for a=1 to4:read var2(a):next >> some code >> for a = 1to 12 >> for b = 1 to 4 >> command, only accepts one argument, has to read 4 numbers from var1 or var2 >> some code >> next a: next b > > No doubt you'll get differing replies, but one solution would be > > var1 = Array(153, 150, 102, 105) > var2 = Array(102, 150, 153, 105) > > Of course dimensioning the arrays and asigning data would be the more > prudent thing to do, but I leave that for you discover....
Show quote
Hide quote
>>> Can someone convert this code to vb6 Please Do you really think anyone is teaching programming using one of the >>> >>> data 153, 150, 102 105,102,150,153,105 >>> for a=1 to4:read var1(a):next >>> for a=1 to4:read var2(a):next >>> some code >>> for a = 1to 12 >>> for b = 1 to 4 >>> command, only accepts one argument, has to read 4 numbers from var1 or >>> var2 >>> some code >>> next a: next b >> >> No doubt you'll get differing replies, but one solution would be >> >> var1 = Array(153, 150, 102, 105) >> var2 = Array(102, 150, 153, 105) >> >> Of course dimensioning the arrays and asigning data would be the more >> prudent thing to do, but I leave that for you discover.... > > Wonder what his teacher advised? ;-) interpreted DOS based BASICs as a basis? That seems very unlikely to me. Hell, except for "old timers" like us, I wonder how many programmers of today have ever worked with an interpreted DOS based BASIC, let alone know the functions and statements that were unique to them (such as DATA, READ, INKEY, etc.). -- Rick (MVP - Excel) Rick Rothstein wrote:
Show quoteHide quote >>>> Can someone convert this code to vb6 Please I was really wondering what spurred the post. The bits within the nested For loops >>>> >>>> data 153, 150, 102 105,102,150,153,105 >>>> for a=1 to4:read var1(a):next >>>> for a=1 to4:read var2(a):next >>>> some code >>>> for a = 1to 12 >>>> for b = 1 to 4 >>>> command, only accepts one argument, has to read 4 numbers from var1 or >>>> var2 >>>> some code >>>> next a: next b >>> >>> No doubt you'll get differing replies, but one solution would be >>> >>> var1 = Array(153, 150, 102, 105) >>> var2 = Array(102, 150, 153, 105) >>> >>> Of course dimensioning the arrays and asigning data would be the more >>> prudent thing to do, but I leave that for you discover.... >> >> Wonder what his teacher advised? ;-) > > Do you really think anyone is teaching programming using one of the > interpreted DOS based BASICs as a basis? That seems very unlikely to me. > Hell, except for "old timers" like us, I wonder how many programmers of > today have ever worked with an interpreted DOS based BASIC, let alone know > the functions and statements that were unique to them (such as DATA, READ, > INKEY, etc.). seemed like instructor code for "fill in the blank", but I could sure be wrong. Sort of an archeological exercise, maybe? <g> I dunno...
Show quote
Hide quote
"Viper900" <Viper***@discussions.microsoft.com> skrev i meddelandet And just to get i compiling, swap Next a: Next b.news:8C360A16-D154-4FBC-AC70-50F5F97E5D67@microsoft.com... > Hi > Can someone convert this code to vb6 Please > > data 153, 150, 102 105,102,150,153,105 > for a=1 to4:read var1(a):next > for a=1 to4:read var2(a):next > some code > for a = 1to 12 > for b = 1 to 4 > command, only accepts one argument, has to read 4 numbers from var1 or > var2 > some code > next a: next b > > Thank you /Henning Henning wrote:
Show quoteHide quote > "Viper900" <Viper***@discussions.microsoft.com> skrev i meddelandet Swap was deprecated in VB. <gd&r>> news:8C360A16-D154-4FBC-AC70-50F5F97E5D67@microsoft.com... >> Hi >> Can someone convert this code to vb6 Please >> >> data 153, 150, 102 105,102,150,153,105 >> for a=1 to4:read var1(a):next >> for a=1 to4:read var2(a):next >> some code >> for a = 1to 12 >> for b = 1 to 4 >> command, only accepts one argument, has to read 4 numbers from var1 or >> var2 >> some code >> next a: next b >> >> Thank you > > And just to get i compiling, swap Next a: Next b.
Show quote
Hide quote
"Karl E. Peterson" <k***@mvps.org> skrev i meddelandet Yeah, andnews:ex3dYQ0oJHA.1288@TK2MSFTNGP02.phx.gbl... > Henning wrote: >> "Viper900" <Viper***@discussions.microsoft.com> skrev i meddelandet >> news:8C360A16-D154-4FBC-AC70-50F5F97E5D67@microsoft.com... >>> Hi >>> Can someone convert this code to vb6 Please >>> >>> data 153, 150, 102 105,102,150,153,105 >>> for a=1 to4:read var1(a):next >>> for a=1 to4:read var2(a):next >>> some code >>> for a = 1to 12 >>> for b = 1 to 4 >>> command, only accepts one argument, has to read 4 numbers from var1 or >>> var2 >>> some code >>> next a: next b >>> >>> Thank you >> >> And just to get i compiling, swap Next a: Next b. > > Swap was deprecated in VB. <gd&r> > -- > .NET: It's About Trust! > http://vfred.mvps.org > Sub Swap(ByRef nxta As Byte, ByRef nxtb As Byte) Dim tmp As Byte tmp = nxta nxta = nxtb nxtb = tmp End Sub will not be of any help either... :)) /Henning
Show quote
Hide quote
>> Swap was deprecated in VB. <gd&r> Why not eliminate creating the 'tmp' variable?>> -- >> .NET: It's About Trust! >> http://vfred.mvps.org >> > > Yeah, and > Sub Swap(ByRef nxta As Byte, ByRef nxtb As Byte) > Dim tmp As Byte > tmp = nxta > nxta = nxtb > nxtb = tmp > End Sub > will not be of any help either... :)) Sub Swap(ByRef nxta As Byte, ByRef nxtb As Byte) nxta = nxta Xor nxtb nxtb = nxta Xor nxtb nxta = nxta Xor nxtb End Sub -- Rick (MVP - Excel)
Show quote
Hide quote
"Rick Rothstein" <rick.newsNO.SPAM@NO.SPAMverizon.net> skrev i meddelandet Too many lines of code from U, just eliminating 1 line. ;)news:%23DLEFz0oJHA.4448@TK2MSFTNGP05.phx.gbl... >>> Swap was deprecated in VB. <gd&r> >>> -- >>> .NET: It's About Trust! >>> http://vfred.mvps.org >>> >> >> Yeah, and >> Sub Swap(ByRef nxta As Byte, ByRef nxtb As Byte) >> Dim tmp As Byte >> tmp = nxta >> nxta = nxtb >> nxtb = tmp >> End Sub >> will not be of any help either... :)) > > Why not eliminate creating the 'tmp' variable? > > Sub Swap(ByRef nxta As Byte, ByRef nxtb As Byte) > nxta = nxta Xor nxtb > nxtb = nxta Xor nxtb > nxta = nxta Xor nxtb > End Sub > > -- > Rick (MVP - Excel) > /Henning
Copying array elements
PaintPicture My concept for a very basic stripboard layouter in VB6 Option buttons become black - no text shown Procedure limit for Form? Where to store database login information in VB6 ActiveX Control Crashes - VB6 Convert statements from VB 2008 to 2003? config file Is one color brighter than the other one? |
|||||||||||||||||||||||