473,508 Members | 4,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling Notepad

6 New Member
Hi,

Could anyone send me code for following problem..

I have two text files, one containing list of names another is a log file containing error description.

I have to find error description from log file for every names in first text file. And i have to copy the description to the first file.

If you able send code for following scenario that wud be fine.

Finding text in notepad (have to get line number).
copying text in particular line and place from notepad.
writing text to particular line.
looping though each line in notepad.

Thanx in Advance.
Mar 14 '07 #1
7 2013
Killer42
8,435 Recognized Expert Expert
Do you need to specifically use Notepad, or are you just referring to text files? Doing this sort of thing from VB code will be fairly simple, but if your program has to drive the Notepad application, that will complicate things.

Is this for an assignment? What version of VB are you using?
Mar 14 '07 #2
sameerkhan
6 New Member
Do you need to specifically use Notepad, or are you just referring to text files? Doing this sort of thing from VB code will be fairly simple, but if your program has to drive the Notepad application, that will complicate things.

Is this for an assignment? What version of VB are you using?

I just referred Text Files. I am using Visual Basic 6.0. Pls send me code to handle text files.
Mar 15 '07 #3
vijaydiwakar
579 Contributor
Hi,

Could anyone send me code for following problem..

I have two text files, one containing list of names another is a log file containing error description.

I have to find error description from log file for every names in first text file. And i have to copy the description to the first file.

If you able send code for following scenario that wud be fine.

Finding text in notepad (have to get line number).
copying text in particular line and place from notepad.
writing text to particular line.
looping though each line in notepad.

Thanx in Advance.
see there is one tech i.e. world wide accepted and that is create ErrorLog tbl in ur db and the problem will be get solved
try it
Mar 15 '07 #4
Killer42
8,435 Recognized Expert Expert
see there is one tech i.e. world wide accepted and that is create ErrorLog tbl in ur db and the problem will be get solved
try it
Who said anything about a database?
Mar 15 '07 #5
Killer42
8,435 Recognized Expert Expert
I just referred Text Files. I am using Visual Basic 6.0. Pls send me code to handle text files.
I think you will need to look up information and experiment for yourself, but we can help steer you in the right direction.

For a start, there are two main methods commonly used for dealing with text files in VB6.
  1. The simple, built-in method using Open, Line Input #, Print #, Write #, Get, Put and Close statements.
  2. The slightly more complex, but more powerful FileSystemObject. To use this one you have to add the Microsoft Scripting Runtime to your project, under Project | References.
You should investigate these (start with the Open and Line Input statements for the former) and decide for yourself which is a better match for your needs.
Mar 15 '07 #6
sameerkhan
6 New Member
I think you will need to look up information and experiment for yourself, but we can help steer you in the right direction.

For a start, there are two main methods commonly used for dealing with text files in VB6.
  1. The simple, built-in method using Open, Line Input #, Print #, Write #, Get, Put and Close statements.
  2. The slightly more complex, but more powerful FileSystemObject. To use this one you have to add the Microsoft Scripting Runtime to your project, under Project | References.
You should investigate these (start with the Open and Line Input statements for the former) and decide for yourself which is a better match for your needs.
Yes Killer you got my problem exactly,

I have already got solution for my problem by using FileSystemObject. But i have write my own logic to implement this. I just want to know whether any direct and easy method to do the same.

I wl narrate my requirment in details

I have text file with some name list as follows.

0400933313
0400934041

and there is one text file which has error description with it as follows.

2007-03-12-17:59:27 Tiff file [44.TIF] has incorrect format.
2007-03-12-17:59:27 Error in document. [0400933313__DOCA]
2007-03-12-17:59:27 Error in batch. [0400933313.ddf]
2007-03-12-17:59:27 Problem processing directory. [0400933313]

I have to copy the description in first line 'Tiff file [44.TIF] has incorrect format' to my text file as follows

0400933313 Tiff file [44.TIF] has incorrect format

P.S. Error description can be find in more than one place, i need to get latest(last) description.

Hope i am clear now. if this can be done directly using any function pls send it to me.

Thanx in Advance.
Mar 16 '07 #7
Killer42
8,435 Recognized Expert Expert
I don't actually understand your question very well. However, in this part...
...
2007-03-12-17:59:27 Tiff file [44.TIF] has incorrect format.
2007-03-12-17:59:27 Error in document. [0400933313__DOCA]
2007-03-12-17:59:27 Error in batch. [0400933313.ddf]
2007-03-12-17:59:27 Problem processing directory. [0400933313]

I have to copy the description in first line 'Tiff file [44.TIF] has incorrect format' to my text file as follows

0400933313 Tiff file [44.TIF] has incorrect format
...how do you know what user ID the error message relates to?

In any case, if you have something that works using FileSystemObject, I would stay with that. Using Open/Close may make your code very slightly simpler, but that doesn't necessarily mean it's any better.

I don't know of any way to automate this kind of thing - you would just need to work out the logic to achieve your goal, then encode it in the programming language. It sounds as though you have already done that.
Mar 19 '07 #8

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

Similar topics

2
10397
by: aejaz | last post by:
Hey all I am new to VC++ I want to have my c++ program output to a notepad file i store my data in arrays and then use cout to output the data in DOS...as i generate data in the order of...
8
6657
by: Mike Smith | last post by:
If I put an old exe file on a web site and create a link to it then IE will ask "open or save to disk?" when clicked. When I create an exe with VS.NET it does not ask anything, it just tries to...
8
401
by: Mike Smith | last post by:
If I put an old exe file on a web site and create a link to it then IE will ask "open or save to disk?" when clicked. When I create an exe with VS.NET it does not ask anything, it just tries to...
3
1846
by: Binu C | last post by:
hi am new to VB. I need to develop an application. The requirements are as follows: We have a notepad which consists of some data(Say A). Now we have a form in which we have some text fields & a...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.