Computing.Net > Forums > Programming > vb6 for each command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

vb6 for each command

Reply to Message Icon

Name: wille
Date: January 2, 2008 at 01:17:32 Pacific
OS: WINDOWS XP Home Edition
CPU/Ram: 3.2GHz
Comment:

Hi!
In vb6 I use the command:
For Each Line In Text1.Text
but this doesn't work, any suggestions?

so sick of vb, never works as supposed to

/thanks in advance


Live The Life As You Know It



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: January 2, 2008 at 04:18:50 Pacific
Reply:

It sounds like you haven't read the manual properly. Why do you think it never works as it's supposed to? Why do you think you can iterate over a string? The For Each command only iterates over collections and arrays. The Text property is just a String.


0

Response Number 2
Name: wille
Date: January 2, 2008 at 06:29:42 Pacific
Reply:

ok thanks I did'nt understand a crap of that, n I dun have a manual

Live The Life As You Know It


0

Response Number 3
Name: klint
Date: January 2, 2008 at 06:48:08 Pacific
Reply:

Let me try again. Text1.Text is a single string, so you can just print it out like a string variable. If your text box is multi-line, the string is still a single string but it contains carriage return characters (chr(13)) to delimit each line. As for a manual, you don't actually need one, as the F1 Help facility contains much useful information to get you going. However, if you have come from an old, procedural type of Basic language (such as the ones you used to get on the old DOS systems), you'll need to know a little bit about object-oriented programming in order to use VB effectively.


0

Response Number 4
Name: StuartS
Date: January 2, 2008 at 07:01:58 Pacific
Reply:

If you don understand what klint was trying to tell you then you need to go back to basics and learn the difference between strings, variables, collections and arrays. Fundamental stuff in any programming language.

There is only one Text1.text so for each is meaningless in this context. However if text1.text was part of an array, e.g text1(0)text, text1(1).text, etc, then it would work. If you learn nothing else, learn about arrays. Very powerful concepts when used properly

The entire VB6 documentation is available on-line - all you ever needed to know about VB6. All you have to do is read it.

http://msdn2.microsoft.com/en-us/li...

Stuart


0

Response Number 5
Name: RugZ
Date: January 16, 2008 at 05:15:30 Pacific
Reply:

In VB.Net, all variable types are derived from the object class. Therefore on "may" iterate using the For...Each loop. No. But then it doesent hurt to read the manual

You can argue, fight and quarrel all you want, but at the end of the day you will have a headache


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

XEX to EXE/COM conversion Dos (?)



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: vb6 for each command

vb, report for each costumer www.computing.net/answers/programming/vb-report-for-each-costumer/3878.html

Batch: accented characters problem www.computing.net/answers/programming/batch-accented-characters-problem/16760.html

loading text into a textbox in VB6 www.computing.net/answers/programming/loading-text-into-a-textbox-in-vb6/7729.html