473,378 Members | 1,078 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,378 software developers and data experts.

How to Not append to a file if a line string is already there?

I have a textbox and the text is automatically updated from a text file, I can also type into the textbox and save it to the file that updates it. How can I make it not append any of the lines I type in if they already exist in the saved file?

I am using readAllText and writeAlltext, should I try using something else such as streamReader or streamWriter?

Any help on this part of my code is appreciated....
May 16 '10 #1
3 1253
Guido Geurs
767 Expert 512MB
dear,

I think you have to load the text into a string var or an array.
In my attachment I have used a string var.
You can check if the string exist with=

InStr([start, ]string1, string2[, compare])

Hope this will help you.

br,
May 16 '10 #2
QVeen72
1,445 Expert 1GB
Hi,

Are you using the same textbox for reading and Writing..?
I guess it will be better to use One more textbox for the new text to be appended.. First read all in the text box, and read new text in Text2, and then check using "InStr", function, if it is <0 then, add to the maintextbox else Ignore it..

Regards
Veena
May 17 '10 #3
vb5prgrmr
305 Expert 100+
considering that this is a .NET question that is in the VB classic section, our solutions may not be what you need to solve your problems. Please PM a mod to have your question moved to the VB.NET forum...



Thanks
May 17 '10 #4

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

Similar topics

40
by: Abby | last post by:
My .dat file will contain information like below. /////////// First 0x04 0x05 0x06 Second 0x07
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
5
by: Piotr | last post by:
I have a qestion about reading file in C++. How can I read a file line by line (i.e. putting a line ends wtih \n in a string) I tried the following, it does read the file, but it does not read...
8
by: Jared Wiltshire | last post by:
Hi, I've written the following code to copy one files contents line by line into another file. However I'm a bit dubious about using the infinite loop to do this. ifstream infile("File1.txt");...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
2
by: Gaby Sandoval | last post by:
I have this code. The user can read teh record from the text file just fine. They can click the NEXT button and it reads the next record (which is just the next line from the text file). If the...
1
by: nitinloml | last post by:
#!/usr/bin/python import string import re import random import sys import time import fileinput tn = time.time() t = str(tn)
6
by: Thomas Kowalski | last post by:
Hi, currently I am reading a huge (about 10-100 MB) text-file line by line using fstreams and getline. I wonder whether there is a faster way to read a file line by line (with std::string line)....
0
by: vijayaprasathdhananjayan | last post by:
Hi, I just wanted to append the following string to my abc.xml file in VB6.0.Please Help <?xml-stylesheet type="text/xsl" href="abc.xsl"?> Thanks
12
by: freeseif | last post by:
Hi programmers, I want read line by line a Unicode (UTF-8) text file created by Notepad, i don't want display the Unicode string in the screen, i want just read and compare the strings!. This...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.