[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 ?
Re: Making spaces in textbox
If it's a Text (Notepad) file your saving to, then use the Print method instead of Write.
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
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. :confused:
Code:
Open "Your Text File.txt" For Output As #1 ' Open file.
Print #1, Text1.Text
Close #1
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
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?
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
Re: Making spaces in textbox
What is your code to save and load?
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.
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
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.
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
Re: Making spaces in textbox
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!:D