Prev: Combobox Showing Right Justified
Next: Can't make exe
From: Cor Ligthert[MVP] on 21 Mar 2010 14:22 > Well your idea is wrong, troll. Your Nxt code does NOT work in VB6. > Typical a Troll answer, somebody else would write what is wrong in it. From Nobody I understand that this would go. I've Windows 7 64 bits here, so I cannot try it. Dim b Dim a a = "Hello World" a = Replace(a, " ", " ") b = Split(a, " ") You mean this wont not compile in any way in VB6?
From: C. Kevin Provance on 21 Mar 2010 15:52 "Mike Williams" <gagamomo(a)yahoo.co.uk> wrote in message news:54a2c078-9b15-410f-8c61-2f7ca115a0af(a)b30g2000yqd.googlegroups.com... : On 21 Mar, 18:22, "Cor Ligthert[MVP]" <Notmyfirstn...(a)planet.nl> : wrote: : : Yes, it won't not compile in VB6 (which of course means it will : compile in VB6). However, it is NOT the code you previously posted in : your dotnet evangelism message. You have changed it so as to remove : your VB.Nxt statements that did not work in VB6 and you have also, for : some reason, changed it so that it uses Variants. Also, as far as : addressing the OP's question is concerned, it is still as out of date : as a curled up British Rail sandwich. : Cause that is what he's paid...er, stipended to do.
From: Saga on 22 Mar 2010 11:27 "Cor Ligthert[MVP]" <Notmyfirstname(a)planet.nl> wrote in message news:eVaUpNSyKHA.3536(a)TK2MSFTNGP06.phx.gbl... > > Dim b Dim a a = "Hello World" > a = Replace(a, " ", " ") > b = Split(a, " ") > > You mean this wont not compile in any way in VB6? > Technically, it will compile in VB6, but the above is not the best approach to the problem. As they say, not everything that glitters is gold and not everything that compiles is good code: a. Dim - why use a variant? both declarations are better off being defined as strings. b. For readability, Dim b should be dim b() ... This tells the code reader early on that it will be used as an array. c. a = Replace(a, " ", " "). This is ok if and only if the string has 2 continous spaces, but will fail if there are more than 2 contiguous spaces in the string. You need some sortof loop to accomplish this objetive thoroughly. Granted, these are trivial issues, but to some one that is begniing in this language it can be misleading. Since you mention that you do not have VB6 installed (not sure if not installed at all or just in the PC where you were when you posted this) I would definitely recommend that you install this development system and test any solutions that you post. Regards, Saga
From: Michel Posseth [MCP] on 22 Mar 2010 17:35 No Mike is right it wouldn`t even compile unless if you have Option explicit OFF and the "require variable declarion setting"switched to the OFF position in the General tab of the options dialogbox otherwise VB6 wil enforce a type declaration , and wich self respecting professional coder whould code with these settings ? ;-) So if it compiles on your side you might investigate the above settings and recompile some of your projects just to be sure .... HTH Michel "Saga" <antiSpam(a)nowhere.com> schreef in bericht news:OLVw%23QdyKHA.5040(a)TK2MSFTNGP02.phx.gbl... > > "Cor Ligthert[MVP]" <Notmyfirstname(a)planet.nl> wrote in message > news:eVaUpNSyKHA.3536(a)TK2MSFTNGP06.phx.gbl... >> >> Dim b Dim a a = "Hello World" >> a = Replace(a, " ", " ") >> b = Split(a, " ") >> >> You mean this wont not compile in any way in VB6? >> > Technically, it will compile in VB6, but the above is not the best > approach to > the problem. As they say, not everything that glitters is gold and not > everything > that compiles is good code: > > a. Dim - why use a variant? both declarations are better off being defined > as strings. > b. For readability, Dim b should be dim b() ... This tells the code reader > early > on that it will be used as an array. > c. a = Replace(a, " ", " "). This is ok if and only if the string has 2 > continous > spaces, but will fail if there are more than 2 contiguous spaces in the > string. > You need some sortof loop to accomplish this objetive thoroughly. > > Granted, these are trivial issues, but to some one that is begniing in > this language > it can be misleading. > > Since you mention that you do not have VB6 installed (not sure if not > installed > at all or just in the PC where you were when you posted this) I would > definitely > recommend that you install this development system and test any solutions > that you post. Regards, Saga > > >
From: Mike Williams on 22 Mar 2010 18:37
"Michel Posseth [MCP]" <msdn(a)posseth.com> wrote in message news:FDB5A490-AC89-487C-98CA-A883FEBC0B7F(a)microsoft.com... >>> [Cor Ligthert said] >>> Dim b >>> Dim a >>> a = "Hello World" >>> You mean this wont not compile in any way in VB6? > >> [Saga said] Technically, it will compile in VB6, but the >> above is not the best approach to . . . > > [Michel Posseth said] No Mike is right it wouldn`t even compile > unless if you have Option explicit OFF and the "require variable > declarion setting"switched to the OFF position in the General tab > of the options dialogbox otherwise VB6 wil enforce a type > declaration , and wich self respecting professional coder whould > code with these settings ? ;-) You're wrong there, Michel, and I think you've got hold of the wrong end of the stick as well. I never said that the above code would not compile. In fact if you read carefully what I actually posted in response to the message which contained that code you will see that I said it /would/ compile, but that it was /not/ the code Cor Ligthert had originally posted when I had previously said it would not. Cor was trying to cover his tracks by querying a statement of mine, which was perfectly true, by changing his previously posted code and by dishonestly pretending to paraphrase it when he repeated his question, hoping that it would not be noticed. So Saga is quite right in saying that Cor Ligthert's latest attempt (as shown above) would compile, and he is of course also quite right in saying that it is not the best approach (for the various reasons he quoted, including the fact that it would default to the Variant data type). Contrary to what you have stated, Michel, VB does /not/ enforce a type declaration in such cases, regardless of whether you are using Option Explicit or not and regardless of the setting of the "Require Variable Declaration" check box in the Options dialog. Option Explicit forces you to declare a variable, but it does not force you to declare its type. All that will happen if you fail to declare its type is that VB will cause the type to default to a Variant. So, Both Saga and myself were correct in saying that Cor Ligthert's latest attempt would actually compile (although his previous attempts would not). Mike |