Can someone please help? I am trying to convert turbo pascal to VB. In the code below, path0, path1, path2 are defined as BYTE, and path as array[0..50] byte. My question is what is the equivalent in VB of
Path1:=[] and path2:=[] ?

Also, how do you test for IF Path[z] IN Path2 THEN in VB?

FOR i:=1 TO Num DO
FOR z:=1 TO Path[0] DO
FOR z:=1 TO Path[0] DO
IF Path[z] IN Path2 THEN

You can define byte arrays in VB like so:

dim Path0(49) as byte

But keep in mind, that's as literal bytes. If the actual path is a string (sequence of characters) you probably wouldn't want to define it as a byte. I'm guessing the TP code IF Path[z] IN Path2 THEN is checking if Path2 contains the same data as a substring as Path[z] has. (so, if Path[z] = "hello", and path2 = "hello world", that it would return true). In VB, this is done with instr function. This thread should PROBABLY be moved to the VB forum, however.... let me know if this is what you had in mind.

Thank you for the pointer. I'm still not 100% sure whats going on with the code, but I shall persevere. Please feel free to move the thread to the VB forum.
Ta again.


Bearing in mind your last reply, I have taken a closer look at the TP code and I have the following declarations:

Elements = SET of 1..255;
Xpath = ARRAY[0..50] of BYTE;


So, I'm I right in saying that Elements is defined as a set of numbers 1 through to 255. So, in VB it would be defined as an integer array, length 255 filled with numbers 1 through to 255.

In the TP code, are Path0, Path1 and Path2 initialised with the following statement Path0:=[] etc

In VB instead of using bytes can I just check for the occurance of Path0,1,2 in the new integer array? Will that do the same thing?


Actually, unless specifically noted otherwise (by the use of option base, or something nuts) then 0 is the default element of an array, so, X(0) would = 1, and X(254) = 255. Declaring it is not the same at all. It looks to me though, that the TP Code (which I know nothing about) is creating a user-defined type (looks like 2 types, but I don't know TP, type 1 being called elements, and type 2 being called Xpath.) Then it looks like variables Path0,Path1,Path2 are defined as type element, and Path is defined as type Xpath. I'm not 100% sure what the program you are trying to re-write does, so it makes it a lot harder for me to try to explain everything.... if you post a new thread in the VB forum, detailing the program you are trying to write, I can probably help more. It's best to have it as detailed as possible, with steps.... it would also help if you explain EXACTLY what the TP program does.....

Hey guys,

I´m searching for a converter for pascal 2 basic. Does anybody know a tool like this? I know that these converters are not very reliable but this is ok. I just want to convert the structure. Thanks for any tips!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.