Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

loading textpath in textbox

Hi,

When loading the textpath into a textbox from a file manager, is there anyway to load it to show the end of the textpath? In other words,the textpath "C:WindowsMediaChord.wav" in a small textbox, would look like "C:Windows". Is there any way to show the end of it instead, so the textbox would read "aChord.wav", so you can read the actual file?


Comments

  • : Hi,

    : When loading the textpath into a textbox from a file manager, is there anyway to load it to show the end of the textpath? In other words,the textpath "C:WindowsMediaChord.wav" in a small textbox, would look like "C:Windows". Is there any way to show the end of it instead, so the textbox would read "aChord.wav", so you can read the actual file?


    You could use something like:


    Var = "This is a test of Size"

    Text1.Text = Right$(Var, 10)







  • : : Hi,

    : : When loading the textpath into a textbox from a file manager, is there anyway to load it to show the end of the textpath? In other words,the textpath "C:WindowsMediaChord.wav" in a small textbox, would look like "C:Windows". Is there any way to show the end of it instead, so the textbox would read "aChord.wav", so you can read the actual file?


    Try to use the Instr function:

    1) Search for the dot (there should be only one, if not... solve it somehow)


    2) Once you know the dot position, search for the various "", the one that you're interested in is the one that's closer to the dot position just retrieved.


    3) Simply extract (mid function) the text from the last "" position plus 1, to the end...


    num = InStr([start, ]string1, string2[, compare])


    start: optional. Sets the initial position for the search, if omitted it starts from the begining. If you specify 'compare' you must enter 'start'.


    string1: required. It's the string on witch you will look.


    string2: required. It's the string you will be searching for.


    compare: optional. Specifies the comparsion type.




    str = Mid(string, start[, length])


    string: required. String from witch the characters will be retrieved.

    start: required. Long position on where to start retrieving.

    length: optional. Number (long) of characters to retrieve. If omitted or length is larger than the string, all characters to the end of the string are retrieved...


    Hope this helps... Jehoshaphat


  • There can indeed be more then one "dot". Win32 allows periods in the folder and filenames and not just to seperate the extension.


    PathName = "C:WindowsMyText.txt"

    For I = Len(PathName) To 1 Step -1

    If Mid$(PathName, I, 1) = "" Then Exit For

    Next


    PathName = Left$(PathName, 1) & Right$(PathName, Len(PathName) - (I - 1))




    Hope this helps!


  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _____ < http://forcoder.org /> free video tutorials and ebooks about \ Visual Basic .NET, Java, JavaScript, PHP, Visual Basic, Delphi, Python, C#, R, Ruby, Go, Assembly, Swift, Perl, MATLAB, PL/SQL, Scratch, C++, Objective-C, C ML, Clojure, SAS, Crystal, Apex, Scala, Rust, COBOL, Dart, Hack, LabVIEW, Alice, Scheme, Erlang, Kotlin, Ada, Lua, D, Logo, Fortran, FoxPro, Bash, ABAP, Transact-SQL, Prolog, VBScript, F#, Julia, Lisp, Awk \ ______________

Sign In or Register to comment.