Results 1 to 20 of 20

Thread: Show Text Name to textbox

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Show Text Name to textbox


    how to show text name to textbox
    ex :

    how to show abc.txt to textbox1 ???
    thanks....
    Last edited by RizChan; Nov 7th, 2010 at 01:12 AM. Reason: wrong image

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Show Text Name to textbox

    vb Code:
    1. f = freefile
    2. open "abc.txt" for input as f  ' use full path
    3.   textbox1.text = input(lof(f), #f)
    4. close f
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Re: Show Text Name to textbox

    thanks but....
    i want to make like this :

    not the contents :

    help...
    please...

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Show Text Name to textbox

    Text1.Text = "abc.txt" ?!

    But it depends how do you choose a particular file that you want displayed. Do you show a Common Dialog so you can browse to the file? Or do you add a FileListBox/DirListBox controls to the form to do it? Or use Dir() function to list files in a particular folder... and so on. You have to explain what exactly you want to achieve before anyone can give you more info.

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Re: Show Text Name to textbox

    ya......
    i want to show abc.txt to textbox ...
    so......., if i load the inside of abc.txt to textbox1

    then the textbox2 show the file name directly

  6. #6
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Show Text Name to textbox

    Quote Originally Posted by RizChan View Post
    ya......
    i want to show abc.txt to textbox ...
    so......., if i load the inside of abc.txt to textbox1

    then the textbox2 show the file name directly
    Or, the opposite ?

    You enter the filename in textbox1 and then textbox2 will display its contents...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  7. #7
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Show Text Name to textbox

    Again, all you mentioned is quite easy to achieve, but depends on how the "abc.txt" file is selected. How do you decide which file name and contents you want to display of all the files on your computer?

  8. #8
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Show Text Name to textbox

    You mean like this?

    Text1.Text = Dir("Test1\*.txt")

  9. #9

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Re: Show Text Name to textbox

    Quote Originally Posted by baja_yu View Post
    Again, all you mentioned is quite easy to achieve, but depends on how the "abc.txt" file is selected. How do you decide which file name and contents you want to display of all the files on your computer?



    Quote Originally Posted by Ellis Dee View Post
    You mean like this?

    Text1.Text = Dir("Test1\*.txt")
    thanks....
    but if i've 2 file ABC.txt and DEF.txt, it won't work. the code just can use to show ABC.txt not DEF.txt

  10. #10
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Show Text Name to textbox

    Means, you want to list the contents of file and the filename, for all files in a folder, one by one ?

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  11. #11
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,911

    Re: Show Text Name to textbox

    -- Can you please ellaberate on what you want us to show you???

    Code:
    Text1.Text = Picture1.Name & ".txt"
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  12. #12

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Re: Show Text Name to textbox

    Quote Originally Posted by akhileshbc View Post
    Means, you want to list the contents of file and the filename, for all files in a folder, one by one ?
    yaa....
    but...
    example :
    if i click on command5 then show file DEF.txt and the contents to textbox

    and if i click on (Ex: Command6) then show file name (ABC.txt) to textbox2 and the contents to textbox1

  13. #13
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,911

    Re: Show Text Name to textbox

    Code:
    Command1_Click()
    Open "Text1.txt" For Input As #1
    Input #1, Text1.Text
    Close #1
    
    End Sub
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  14. #14
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Show Text Name to textbox

    Quote Originally Posted by RizChan View Post
    yaa....
    but...
    example :
    if i click on command5 then show file DEF.txt and the contents to textbox

    and if i click on (Ex: Command6) then show file name (ABC.txt) to textbox2 and the contents to textbox1
    Still it is not clear about how you'll get the filenames ! I mean, whether the filenames are hardcoded or found from a folder or from a filelistbox, etc..!

    Quote Originally Posted by RizChan View Post
    if i click on (Ex: Command6) then show file name (ABC.txt) to textbox2 and the contents to textbox1
    The code for doing this is already posted by westconn1 in post#2

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  15. #15

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Re: Show Text Name to textbox

    Quote Originally Posted by akhileshbc View Post
    Still it is not clear about how you'll get the filenames ! I mean, whether the filenames are hardcoded or found from a folder or from a filelistbox, etc..!
    this is :
    SHOW Code:
    1. "" + App.Path + "\Test1\abc.txt"

  16. #16
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Show Text Name to textbox

    Instead of + use & for string concatenation. You also don't need the first "" +... there's no point.

    So, I don't see what's the problem?! Just do

    Text1.Text = App.Path & "\Test1\abc.txt"

  17. #17

    Thread Starter
    Member
    Join Date
    Apr 2010
    Posts
    49

    Re: Show Text Name to textbox

    Quote Originally Posted by baja_yu View Post
    Instead of + use & for string concatenation. You also don't need the first "" +... there's no point.

    So, I don't see what's the problem?! Just do

    Text1.Text = App.Path & "\Test1\abc.txt"
    Hahaha...
    i don't know if this char ("" +) not use...
    thanks for the tips...
    and...
    @all thanks for help me, i think i got what i want to do...

  18. #18
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,911

    Re: Show Text Name to textbox

    -- I never knew that you could use the + for inconjunction of the & characters!!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  19. #19
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Show Text Name to textbox

    Quote Originally Posted by ThEiMp View Post
    -- I never knew that you could use the + for inconjunction of the & characters!!
    That's a good thing. It means you've never made the error that most nubes did.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  20. #20
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,911

    Re: Show Text Name to textbox

    --Why thankyou, CDRIVE...
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width