+ Reply to Thread
Results 1 to 12 of 12

Textbox: write and change different lines, get values of each line

  1. #1
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Textbox: write and change different lines, get values of each line

    I'm looking for a solution to write values to different lines in a textbox.

    so far my code is:
    Please Login or Register  to view this content.
    The "bedrag" and "rekening" come from a textbox and a combobox.
    When I change the combobox, the txtinboekenbedrag.Value and cboinboekenrekening.Text get written to the textbox underneath. After that, the textbox and combobox need to return to blank again.

    Is it possible to create a code that writes the 2nd input in textbox and combobox on the second line in the textbox like this:

    Input 1 = value in textbox and combobox -> write to line 1 in textbox
    Input 2 = new value in textbox and new value in combobox ->write to line 2 in textbox.

    Furthermore, is it possible to be able to select a line from the textbox, and alter the variables?
    Last edited by pclaesen; 06-24-2015 at 08:45 AM.

  2. #2
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Textbox: write and change different lines, get values of each line

    Sure, here you go .
    Attached Files Attached Files

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Textbox: write and change different lines, get values of each line

    Try using Char(10) instead of Space(10).
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Textbox: write and change different lines, get values of each line

    Quote Originally Posted by Norie View Post
    Try using Char(10) instead of Space(10).
    I need the space(10) just to put some distance between the value of the textbox and the text from the combobox.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Textbox: write and change different lines, get values of each line

    I thought you wanted the values on different lines?

  6. #6
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Textbox: write and change different lines, get values of each line

    Yes, but (I'll edit the first post after this) I need this:

    Input 1 = value in textbox and combobox -> write to line 1 in textbox
    Input 2 = new value in textbox and new value in combobox ->write to line 2 in textbox.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Textbox: write and change different lines, get values of each line

    I'm a little confused the textbox named txtinboekenoverzicht is only one row/line high, so how will the user view multiple lines in it?

    If you really want to add more text to the textbox on the next line try this.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Textbox: write and change different lines, get values of each line

    Norie, yo're correct, I forgot to make it bigger before saving.
    I'll try your code, thanks for the fast reply.
    Will this work for an infinite number of new lines?

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Textbox: write and change different lines, get values of each line

    Why not use a listbox?

  10. #10
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Textbox: write and change different lines, get values of each line

    Ok it works like a charm Norie, cheers! And I got my own question answered.

    Now for the second part of my question: Can I 'Get' the values that are written in that particular textbox? I'd use them to check if the invoice total equals the values that are written tot eh textbox. Or do I need to use another type of box to wrtie the values to?

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Textbox: write and change different lines, get values of each line

    How do you want to 'get' them? Do you want to separate the 2 values, bedrag and rekening, on each line?

    If you were to use a 2 column listbox instead of that would be easy, if you stick with the multiline texbox it can still be done but it would be a bit more complicated.

  12. #12
    Registered User
    Join Date
    04-08-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Textbox: write and change different lines, get values of each line

    Yes I'll use the listbox with 2 columns, that'll be easier.
    I would like to use the values to check the invoice total compared to the values that are written to the textbox

    First I'd need to make a total of the values written to the textbox (boxtotalvalue)
    I'd then use something like this:

    If txtnettoaankoop.Value <> boxtotalvalue Then
    Msgbox "Please check your input"
    End If

    I just don't know if and how I can get those values from the text box. Or would it be easier if I write the values to a separate location, right after I input them and before they get written to the textbox?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 01-08-2015, 03:34 PM
  2. Line graph with two lines that start at different x values
    By baldbanker in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-12-2014, 10:07 AM
  3. Replies: 4
    Last Post: 01-29-2014, 05:53 AM
  4. Displaying single line of text on several lines in a textbox
    By Brunstgnegg in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-19-2010, 10:34 AM
  5. Line graph with two lines that start at different x values
    By lmorett in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 10-14-2009, 04:46 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1