Consulting

Results 1 to 11 of 11

Thread: Solved: Still wondering - is there a way to set tabs in a Text Box??

  1. #1

    Solved: Still wondering - is there a way to set tabs in a Text Box??

    Hi All,

    I just found out that I still have a need to be able to set Tabs in a Text Box. The attached form would explain it a bit better than I can.

    I really do not know. If there is a way.

    Please help.

    Trudy

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hi Trudy,

    I believe the short answer is "no".

    A textbox just collects character codes and displays them in-line (although there's some font formatting available). AFAIK there's no property available to set.
    A determined coder would probably argue that you could force the issue by intecepting a tab with the keypress event, backspacing and counting back the length of that entry and inserting spaces (with each field therefore needing a max size) etc - there are a few headaches to deal with along the way, I'd be surpised if it worked very well...

    Looking at the form, would it not be better to have those entries as individual text boxes? You can always change the properties on the textboxes and labels (borders, specialeffect, etc) to give it more of a "table" feel.
    K :-)

  3. #3
    Hi Killan,

    I thought so - that there is no way to set tabs in a text box (would be nice though), but I had to ask.

    To place the information in individual text boxes would be great IF we would always know how many entries there are!! There could be only 1 or there could be 10+. This is why I have the table with the bookmarks copied and inserted as often as needed.

    I think the only way around that is to put the 'charges' part of my table at the end of the unpotected area and the user can then just use the TAB key to insert a new row and carry on.

    And after they are done and need a new warrant entry - the routine would be the same, insert (copy) the table and once the dialog box has populated (dumped) the text into the table, they use the TAB key to carry on.

    Or can you find another way??? Im still somewhat a greenhorn in VBA coding, but I am learning quick.

    thanks for your quick response.

    Trudy

  4. #4
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    I am not seeing the form. Is there a file attached here somewhere????

  5. #5
    Hi Fumei,

    I just re-loaded the attachment. I hope you can see it now.

    Trudy

  6. #6

    Still wondering

    Hello again,

    The problem I am facing that I do not know how many of the warrants there are at any given time - this is why I have the table part copied and inserted as often as needed. At the same time - we do not know how many charges are there on each warrant.

    Is there any other way I could takle that problem??????

    Trudy

  7. #7
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Well I guess another way would be to have a slightly different interface, where you enter the data into 5 textboxes and then add that 5-item record to a listbox. Then you can build up the list and add it all as a table when you're done.
    That way you can have your labels (column headings), txtboxes(entry field) and listbox columns all the same width.
    I've attached an working example
    K :-)

  8. #8
    Hi Killian,

    I think I am going crazy.....I tried out the Doc1.doc with the form and it worked out just great there......no I am trying go go back to the form to see how to implement it into my form - and the little beast is not inserting a new table nor is it inserting any data...What??? did I do??? I did not change the macro in any way. I re-opened a new copy from your post - still the same result.

    I am sooooooo confused.

    Trudy

  9. #9
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Well you're not going crazy - you needed to change the code a little - or at least match the objects on the form to the code. It was a little complicated - I've amended you're form and matched up the control names to the code and added to "Done" code to your "OK" code and it seems to work.
    I ended up making a table of the column headings and moving the bookmark into it so now the code adds the appropriate number of rows to that table, formats them and then adds the data, so it's changed a little, but the principles still the same
    K :-)

  10. #10
    Hi Killian....

    This is me now:

    With a bit of juggling and tweeking and whatnots...Thanks to your help..the form is DONE.


    Thank you====Thank you!!! You folks are AWESOME!!!!!

    I am learning so much from reading and asking. This has to be the most useful forum that one can get help in.

    I hope withing a few months of learning I could be able to give someone like me (today) a leg up.

    Thanks again.

    Trudy

  11. #11
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Nice sollution to this problem K!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

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