Archived

This topic is now archived and is closed to further replies.

From C to VB

This topic is 6581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I don't really know VB, so I can't help you there, but I can tell you that ++abc increments abc by one. It is different from abc++ in that it increments abc BEFORE abc is used in an expression, and abc++ increments abc AFTER it is used in an expression. For example, if abc is an int and initially has a value of 5,

cout << ++abc;

would display 6, and

cout << abc++;

would display 5

in both cases, though, the value of abc would be 6 after this line is executed.

- Dave

Share this post


Link to post
Share on other sites
"break" in C/C++ gets you out of a looping construct. This means it exits out of for loops, while loops, etc.

For instance, if you are in a for loop, break takes you to the line of code just after the for loop ends.

In VB, Exit For would be the equivalent of break when used in a For loop. There's also Exit Do.

Hope that's clear...

As far as the array goes (the bracketed variable), this code is simply creating an array and initializing the values in the array. Not sure how you initialize arrays in VB other than doing it by hand.

The big thing to remember on arrays is that C/C++ arrays ALWAYS start at 0. In VB, they start at 1 by default unless you specify Option Base 0.

Share this post


Link to post
Share on other sites
Hmm... I always thought it was the other way around: all arrays start at 0 unless you cheat with the Option Base statement.

I just checked - if you declare it as size 0, then by default (at least in VB5) you can access x(0), so a size 1 array actually has 2 entries.

Dim x(size)

actually means

Dim x(ubound)

As for batch filling, I don't think there is a way... QBASIC used to have the DATA statement I think, but once I got VB I just stored all my data in a file and read it as a chunk or used a For loop. The only other thing I can tell you is the VB equivalent of char is Byte I believe.

------------------

Lack

Share this post


Link to post
Share on other sites
Does someone know what is the corresponding function of break in Visual Basic?
Also, what this ++abc means (abc is variable)?
And does someone know how to do this in VB:

char terrain_texture[] =

{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,11,0,11,0,0,11,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1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