Results 1 to 14 of 14

Thread: [RESOLVED] Making spaces in textbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Resolved [RESOLVED] Making spaces in textbox

    Hi i want to create a Word program kinda like.
    I'm using the Dim Writer/reader to save my notes in a specific folder.
    I have enlarged a textbox and want to make it understand what i want example.

    I write in textbox
    A
    B
    But in my saved document it's A B, how do i make it so it's get that space i want it to ?

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

    Re: Making spaces in textbox

    If it's a Text (Notepad) file your saving to, then use the Print method instead of Write.
    <--- 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??

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Making spaces in textbox

    I'm using the print, but i want the textbox to print a "down space" instead of a normal space

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

    Re: Making spaces in textbox

    Quote Originally Posted by macbrutal
    I'm using the print, but i want the textbox to print a "down space" instead of a normal space
    I think you should post your code because if you have your TextBox set to Multiline = True and you type....

    This is line 1
    This is line 2

    Then that's how it should output it to your text file when using Print.

    Code:
    Open "Your Text File.txt" For Output As #1             ' Open file.
          Print #1, Text1.Text
       Close #1
    <--- 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??

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Making spaces in textbox

    It doesn't work T_T

    Scrollbars 3-both multiline = true I'm starting to get pissed off here!
    well i've seen a movie on youtube or something when a guy showed us how to do, but i dont regognize the name of it , :S

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

    Re: Making spaces in textbox

    Quote Originally Posted by macbrutal
    It doesn't work T_T

    Scrollbars 3-both multiline = true I'm starting to get pissed off here!
    well i've seen a movie on youtube or something when a guy showed us how to do, but i dont regognize the name of it , :S
    If I thought that getting pissed off would help you I would tell you to have at it! I don't think it's going to help though.
    I just noticed your handle macbrutal. Does this handle relate to the Mac OS?
    <--- 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??

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Making spaces in textbox

    That wasn't a handle that was just something to show you what settings i've done.
    Anyhow.. I want to just press the enter/return button and it change to the row just under and so you can with multiline, but it doesn't saves like that when i save it into a txt file :S

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Making spaces in textbox

    What is your code to save and load?

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

    Re: Making spaces in textbox

    Quote Originally Posted by macbrutal
    That wasn't a handle that was just something to show you what settings i've done.
    When I said handle I meant your User Name and this is the second request that you didn't respond too. As Si posted, I also asked you to post your code and I asked you if you're using MAC.
    <--- 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??

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Making spaces in textbox

    Sorry CDRIVe didnt get you, NO im not using MAC.

    Code:
    Dim namefile As String
    namefile = Text1
    If Text1.Text = "" Then
    MsgBox "Fill in a text"
    Else
    If Text2.Text = "" Then
    MsgBox "fill in a title!"
    Else
    Open App.Path & "\folder\" + namefile + ".txt" For Output As #1
    Print #1, text1.Text
    Close #1
    End If
    End If
    End Sub

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

    Re: Making spaces in textbox

    First off you should not use '+' in VB unless you're doing addition. It's not proper to use it to concatenate variables or strings. You should be using '&' instead. Secondly the structure of your code is rather odd. Do you have two TextBoxes, Text1 and Text2? What are you attempting to do here? Are you trying to name the text file by the text in Text2 and save the data from Text1?
    Did you ever run the very simple code that I posted in post 4? All you need to do is put that code in a Command_Click event.
    <--- 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??

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

    Re: Making spaces in textbox

    Try this:
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
       Dim strFileName As String
       Dim strText As String
       strFileName = Text2.Text               ' Give the file a name.
       strText = Text1.Text                   ' Text to put in the file
          If Text1.Text = "" Then
             MsgBox "Fill in some text in Text1"
             Text1.SetFocus
          End If
             If Text1.Text <> "" And Text2.Text = "" Then
                MsgBox "Type a file name with no extension!"
                Text2.SetFocus
             Else
                ChDir (App.Path)
                Open strFileName & ".txt" For Output As #1
             Print #1, strText
          Close #1
       End If
    End Sub
    Last edited by CDRIVE; Aug 9th, 2008 at 10:14 PM. Reason: Edit code
    <--- 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??

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Making spaces in textbox

    It worked your the man!

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

    Re: Making spaces in textbox

    Quote Originally Posted by macbrutal
    It worked your the man!
    I'm more than glad to help you. When I wrote that code I wasn't quite sure what you were attempting to do, so I was winging it!
    <--- 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??

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