Code:
	dim charCnt(1)
call allcombos "abc",3
sub allcombos charstr$,combolen
    redim charCnt(combolen)
    charstrlen=len(charstr$)
    for i=1 to charstrlen^combolen
        t$=""
        for k=combolen to 1 step -1
            t$=t$+mid$(charstr$,charCnt(k)+1,1)
        next k
        print t$
        charCnt(1)=charCnt(1)+1
        for k=1 to combolen
            if charCnt(k)=charstrlen then
                if k<combolen then charCnt(k+1)=charCnt(k+1)+1
                charCnt(k)=0
            end if
        next k
    next i
end sub
 credits go to Kc, written in basic.