PDA

View Full Version : visual basic q from a m8



csinclair83
17-09-2003, 10:13 PM
a m8 is learning vb...
and hes just asked me about coding and what they mean...
coz he wants to learn it but for example..

Form1.show
For i=1 to10
print i
next i

he wants to know what each line means and would do what...
this example would put numbers 1-10 on the form when u run program..

i think this q is confusing..so i aplogise if it is...i know what hes after but wasnt sure how to write it in here...and i wouldnt know what to actually search for...

beama
17-09-2003, 11:01 PM
> a m8 is learning vb...
> and hes just asked me about coding and what they
> mean...
> coz he wants to learn it but for example..
>
if i remember vb6 correctly
> Form1.show
show the form to the user

> For i=1 to 10
while i greater than or equal to 1 and less than or equal to 10 do the following

> print i
print the value of i

I would use this though so that the values can be seen by a human. (A label would need to created on the form though)
Label1.Caption = i
changes the value of label1's caption property to that of i

> next i
increments counter i by 1 until value 11(which is greater than 10) is reached then loop completes and finishes

you would also need to declare i as variable ie DIM i AS INTEGER
at least I did when testing this code otherwise vb6 threw errors

csinclair83
17-09-2003, 11:02 PM
thanks for that but he actually wants the whole list...every code u can use and its meaning..if thats possible to get on the web..

beama
17-09-2003, 11:21 PM
thats quite an extensive list of methods and examples, vb6 has some great help files with example code (thats how I learnt) also a search on google is also often very rewarding or I Think think there is also a book on vb6 in the dummies series (not trying to be cheeky or nasty) so check your local library as well.

Learning a programming language can whole lot of fun and frustration bundled into one, but when the result is gained, its very rewarding. Also once you have learnt one language it gets easier to learn others. I started out with QBasic, Pascal, Java (not script) then taught myself vb6 (now I'm old and grey :p being silly now sorry)Since then I have written some custom utilities which are used daily.

My advice to your friend don't give up its a whole lot of fun
Good luck

parry
18-09-2003, 12:01 AM
> thanks for that but he actually wants the whole
> list...every code u can use and its meaning..if thats
> possible to get on the web..

Well you can get every code and meaning - its within the VB application help itself which is what youll need to do coding anyway. But in the example i isnt a codeword, its a variable. he would need to understand how to start a procedure, define variables and do basic conditional checks (for next, do loops etc) etc.

Like any langauge you dont need a big list of every possible option to learn. You just start with some basics and learn more as time goes on. Like when you started school they didnt give you a dictionary and say see you in a couple of months and suddenly you know English. The words dont really mean much by themselves at first until you've learnt some basic ones first and used them in some context.

Your friend is best to get a book on VB - you could pick up on of those Learn in 24 hours jobbies for about $20-30. Maybe even easier would be learning a bit of VBA. Run a macro in Word or Excel (if he has it), then look at the code (tools-Macros-VB Editor) and see what its done. You can highlight a word with your mouse and press f1 and help comes up on that particular keyword. I would suggest Excel in preference as Word tends to put a lot of code that isnt necessary when using macros.

good luck.

DangerousDave
18-09-2003, 08:16 AM
Try MSDN
www.msdn.com
but beware it can be a bit complicated for someone new to programming and the search is crapola.
Otherwise...
www.informit.com
these are oldish books, that have been released on the net as e-books. Something may be found here...

- David