|
-
Aug 8th, 2008, 04:39 PM
#1
Thread Starter
Lively Member
[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 ?
-
Aug 8th, 2008, 05:03 PM
#2
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?? 
-
Aug 8th, 2008, 07:14 PM
#3
Thread Starter
Lively Member
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
-
Aug 8th, 2008, 09:10 PM
#4
Re: Making spaces in textbox
 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?? 
-
Aug 9th, 2008, 06:57 AM
#5
Thread Starter
Lively Member
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
-
Aug 9th, 2008, 08:02 AM
#6
Re: Making spaces in textbox
 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?? 
-
Aug 9th, 2008, 09:34 AM
#7
Thread Starter
Lively Member
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
-
Aug 9th, 2008, 09:48 AM
#8
Re: Making spaces in textbox
What is your code to save and load?
-
Aug 9th, 2008, 10:47 AM
#9
Re: Making spaces in textbox
 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?? 
-
Aug 9th, 2008, 05:21 PM
#10
Thread Starter
Lively Member
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
-
Aug 9th, 2008, 07:14 PM
#11
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?? 
-
Aug 9th, 2008, 09:45 PM
#12
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?? 
-
Aug 10th, 2008, 09:19 AM
#13
Thread Starter
Lively Member
Re: Making spaces in textbox
-
Aug 10th, 2008, 10:13 AM
#14
Re: Making spaces in textbox
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|