i couldn't edit my previous post or can't delete.
so i open new. sorry again
i have two text file

one is a.txt and another is b.txt

content of a.txt is

a
b
c
d

content of b.txt is

1
2
3
4
5
6
7
8
9

i want to process each a.txt line to choice random range of b.txt lines.

for instance.

for each aa as String in a.txt

for bb as integer = 0 to b.txt.count - 1
 'after one times execute for loop i want to exit here
exit for
end for

end for

so what i want to get result is like this one

each a.txt line to random range of b.txt lines

a12
b3456
c789

Let me see if I understand what you want.

for each line in a.txt
    pick two random numbers (lo,hi) in the range 0 to b.txt.count - 1
    output line
    for i = lo to hi
        output i
    next
    output newline
next

If that is what you want then it should be easy to translate the above into actual code. What I don't understand is

'after one times execute for loop i want to exit here

What is the point of using a loop if you always exit after one iteration?

And for future posts, please indent your code. It makes it easier to read and increases the odds of getting a response.

yes i think it correct what i want to implement.

'after one times execute for loop i want to exit here
this meaning is if not exit For loop it will be continue looping so
after one times execute i want For loop exit and continue go back to a.txt file
and read continue processing.
i hope this make sense.
thanks again!

'after one times execute for loop i want to exit here. this meaning is if not exit For loop it will be continue looping so after one times execute i want For loop exit and continue go back to a.txt file and read continue processing. i hope this make sense.

Actually, it doesn't.

Given the pseudo code I provided you should be able to create the corresponding vb code. When you generate the two random numbers (call them r1, r2) you will have to test if r1 > r2 and swap them if true.

this is great ! i resolved problem! thanks jim again!

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.