iara84 said:
this works in other programming languages
As Mike already said
Mike Lewis said:
that's never going to work
Well, not as you used it. For example JS console (in a browser):
If you have + inside of a string, it's just a "+" character, it's not the + operator for strings used as short notation for concatenation. Never, in no programming language.
Also not in other dynamically typed languages, where string concatenation does indeed often do implicit type conversions. But stillnot always. Not in VFP, for example.
I know you wanted to write "customer"+x. That's not the point, but you err in thinking there is a general rule of dynamically typed language to make all implicit type conversions. VFP is a mixture of strongly and dynamically typed. Operators like + are overloaded to support both mathematically adding numbers and concatenating strings, as it's in almost all programming languages, but VFP does not do implicit conversions from number to string, for example, in places you expect it. you have to live with the rule of the programming language you use, not what you wish for.
VFP has macro substitution, look up how that works. But you're still overall trying a route that's not a good solution and means more work than you need if you would stop insisting on doing things your way and instead ask or follow advice about how to do things the foxpro way.
Let me predict someone will come and argue that using macro substitution it will be easy to do as your wish to iterate your code four times and address all the different controls is possible. I am referring to the warning I gave you about using several groups of controls. That's perhaps HTML style of doing things, nobody needs to maintain HTML forms, they are generated with hell breaks loose ignorance of principles you'd do when designing and maintaining UI visually in winforms, like VFP does its UI.
The main point is, others will even encourage you to use macro substitution for your case, as it's a nice way to learn this feature/tool and make good use of it, while I will say "stop!". Just because some feature is nice and very FoxPro-specific, it's not automatically the best solution. You see from several threads you have now how many problems arise from you trying to use individual textboxes instead of a grid, which is meant to be used for a list of data. Always first find the right context of what to use for something and then dive into details. Your style of working out what to do is head over heels in that respect.
Sorry, it's normal to have beginner problems getting grips about concepts and failing to map your knowledge from other programming languages and platforms to something new. But then that's the reason you get interventions and advice from here. If you stick to something that just causes much more work and pain than simply following advice, then you never will see how simple things are, if you just use the right way, the right controls, for example.
Winforms never is HTML and vice versa. Try to understand the paradigms can't be mapped onto each other. What is good practice in one isn't in the other. One major difference: HTTP is stateless and you do a lot with your HTML+JS+backend programming to overcome this, even though this very disadvantage of HTTP is praised at the same time. In Winforms, also in VFP you have a stateful process you run that is all in one, client and business logic, only data is in files at a file server. It's head over heels and so you also work head over heels in VFP vs HMTL. In HTML the browse is mainly just the frontend visual representation, actions are done on the server side, if you don't bring it to the client side with the help of JS. You have a lot of communication between a client browser and the server, serve a lot of sessions all at once and may be sparse about only paging data. In VFP, on the other hand, there is little to do on the server side, the form has also the code to act on itself and the DBFs, you don't have a bottleneck here which you have in HTML. There still is the network that's the bottleneck for data, but that's not a reason for paging data in portions of 10 or 4 records. The grid actually is clever in only fetching as much data as it needs to fill its visible portion, it does not load all millions of records of a DBF just because a DBF has a million records. You don't even know how many things you get for free in VFP without programming a single line for it, just by using and combining the right things.
Chriss