VB : Problem with loops
VB : Problem with loops
(OP)
Many years I used a turbo pascal, Fortran as program software. As VB is the commonly used software now, I try to do some application with it. I find all what I learned in the others program, but in the beginning it seems for me to be hard to success my first application. In fact, my application begins by getting a list of number and compare them to another list, and each time one element of getting list equal to giving list the text of the label display 1.
Getting and displaying the list : I have labels named num1, …num10.Progressively, I entered the list, numi displays the number i of the list. And if this number is equal to one of the getting list, the label text Ri will display 1. My problem is that Vb doesn't recognize this loop :
For i=1 to 10
If numi.text = S then Ri.text = 1
Next i
Can help ?
Getting and displaying the list : I have labels named num1, …num10.Progressively, I entered the list, numi displays the number i of the list. And if this number is equal to one of the getting list, the label text Ri will display 1. My problem is that Vb doesn't recognize this loop :
For i=1 to 10
If numi.text = S then Ri.text = 1
Next i
Can help ?





RE: VB : Problem with loops
If num(i).text = S then R(i).text = 1
RE: VB : Problem with loops
Regards
Steven van Els
SAvanEls@cq-link.sr
RE: VB : Problem with loops
I tried it, doesn't work.
svanels,
Delphi 7 is equivalent to Turbo Pascal ?
RE: VB : Problem with loops
All is compiled in an executable file without the need to distribute dll's. This at the famous turbo pascal speed.
If you are familiar with units in TP, delphi must be no problem at all. Delphi 7 was released recently, so we talk about roughly 8 years of improvement from the dos based Turbo Pascal.
Did you know you can embed the mathcad engine in a Delphi program, or the autocad dwf viewer?
If you want to know more, join us at www.tek-tips.com in the Delphi and Pascal forums.
Best regards
Steven van Els
SAvanEls@cq-link.sr
RE: VB : Problem with loops
I downloaded the Deldhi7 (It takes 5 hours!). They say that 'let say ' trial version for which they send the key "number" and is supposed to be used without problem. When installing, I was obliged to re-registered. What is this game ?
I tried to run some installed programs (BCDE, ...), I don't understand their utility.
I think that it is far of the level of the reliable programme Turbo Pascal. It's my first impression ! I'm frustrated !
In stead of to make it easy, they complicated the matter !
RE: VB : Problem with loops
How did you feel when starting with VB?
Here is a link with some on-line tutorials for beginners
http://www.delphi.about.com/library/weekly/aa020202a.htm
Send me your e-mail address so we can discuss things better.
Regards
Steven van Els
SAvanEls@cq-link.sr
RE: VB : Problem with loops
Is 'S' a predefined variable? (Dim S as string ?)
the .text properties of textboxes allow only text.
the "R(i).text" above sounds like a control array,
(an array of similarly named controls), is it?
If so, you cant assign a number (=1) to a text box...
you can assign a STRING variable that is "1"...
If num(i).text = "S" then R(i).text = "1"
hope this helps
RE: VB : Problem with loops
I defined S as a function and add define it; doesn't work !
I defined this loop as a procedure and add define it; doesn't work !
I have defined textboxes Ri (i=1 to 14). How can can apply this loop : For i=1 to 14 is numi.text = 14 then Ri.text = 14 next i.
I don't know how it can be resolved !
RE: VB : Problem with loops
Do this by adding a textbox to a new form, renaming the textbox to num, then copy and paste that box back into the form. VB asks if yopu want an array - answer yes. Repeat pasting till you have your 10 boxes. They will be on top of each other, so drag them to where you want them. Repeat for the other array R(0) to R(9)
Then Refer to them as num(0) to num(9) as arrays are generally 0 based in VB
Then you loop will look like :
For i = 0 to 9
If num(i).text = 14 then r(1) = 14
VB will take care of assigning a number to a string
Let me know if this helps