473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Saving Text Without Extra Line

7
When I save text to a file it always ads an extra blank line. It is a pain because I have a RC4 encrypter in the program so another line messes it up and adds strange characters. I have tried different ways of saving but they all have the same effect. Any ideas on how to save without another line?

Thank You
Nov 12 '06 #1
5 1611
willakawill
1,646 1GB
When I save text to a file it always ads an extra blank line. It is a pain because I have a RC4 encrypter in the program so another line messes it up and adds strange characters. I have tried different ways of saving but they all have the same effect. Any ideas on how to save without another line?

Thank You
Hi. Do you have any code so that we can see what is happenning with your save?
Nov 12 '06 #2
Killer42
8,435 Expert 8TB
Hi. Do you have any code so that we can see what is happenning with your save?
Yeah, it would help if we could see what you're doing now.

However, here's a suggestion. If you are using Print # to write stuff to the file, you could try using a semicolon to leave the line-break off the last line. For example, given this setup...
Expand|Select|Wrap|Line Numbers
  1. Open "Text.txt" for output access write lock write as #1
these two blocks of code will produce the same text file, but the second will have one extra line.
Expand|Select|Wrap|Line Numbers
  1. Print #1, "This is the 1st line"
  2. Print #1, "This is the 2nd line"
  3. Print #1, "This is the 3rd line" ;
  4.  
Expand|Select|Wrap|Line Numbers
  1. Print #1, "This is the 1st line"
  2. Print #1, "This is the 2nd line"
  3. Print #1, "This is the 3rd line"
Nov 12 '06 #3
Skidlz
7
I am using

Expand|Select|Wrap|Line Numbers
  1. Dim hFile As Long
  2.    Dim sFilename As String
  3.  
  4.    sFilename = Text2
  5.  
  6.    hFile = FreeFile
  7.    Open sFilename For Output As #hFile
  8.       Print #hFile, Text1.Text
  9.    Close #hFile
Found it on a site and changed it to Text2.
Nov 12 '06 #4
Killer42
8,435 Expert 8TB
I am using
Expand|Select|Wrap|Line Numbers
  1. Dim hFile As Long
  2.    Dim sFilename As String
  3.    sFilename = Text2
  4.    hFile = FreeFile
  5.    Open sFilename For Output As #hFile
  6.       Print #hFile, Text1.Text
  7.    Close #hFile
Found it on a site and changed it to Text2.
Well, that's nice and simple. If you add a semicolon onto your Print #hFile statement, that should do the trick.
Expand|Select|Wrap|Line Numbers
  1. Dim hFile As Long
  2.    Dim sFilename As String
  3.    sFilename = Text2
  4.    hFile = FreeFile
  5.    Open sFilename For Output As #hFile
  6.       Print #hFile, Text1.Text ;
  7.    Close #hFile
Nov 12 '06 #5
Skidlz
7
Yeah! That did it.
Thank you!
Nov 12 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Guyon Morée | last post by:
what is the difference? if I open a text file in binary (rb) mode, it doesn't matter... the read() output is the same.
11
by: Frostillicus | last post by:
I'm having difficulty creating a menu on the left of a web page where each link appears to have a 4px padding around the edge but I'm trying to do this as a pure unordered list. The "current web...
36
by: spence | last post by:
Hi All How do I make it so that when a user clicks in a search text field, the default entry (in this case "Search") is removed automatically - they are then faced with a blank search box and...
6
by: Vijay | last post by:
I need to generate HTML files based on the some codes. One HTML file per code. I have the link (ex:http://123.234.345.456/WebPages/GetTestData.aspx?SomeCode=25), by passing the code as parameter I...
13
by: Stuart McGraw | last post by:
I haven't been able to figure this out and would appreciate some help... I have two tables, both with autonumber primary keys, and linked in a conventional master-child relationship. I've...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
12
by: Anon | last post by:
Hello All! I was wondering how I can go about saving the last string entered into a textbox. I would like to save username or pwd info in textboxes in my forms so that users don't have to...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
13
by: michaelp | last post by:
Hello! I am teaching programming, and display code snippets with line numbers for easy reference. If possible, I would like to make these line numbers non-sselectable, so that if students...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.