473,586 Members | 2,817 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 2015
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 FileSystemObjec t. 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 FileSystemObjec t. 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 FileSystemObjec t. 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__DOC A]
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__DOC A]
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 FileSystemObjec t, 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
10400
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 1000's ...i am having a problem with physically copy pasting the data into notepad
8
6664
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 run it. Is there a bit I can set somewhere that will tell IE to treat this like a "classic" exe? It make is kind of hard to create setup.exe style...
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 run it. Is there a bit I can set somewhere that will tell IE to treat this like a "classic" exe? It make is kind of hard to create setup.exe style...
3
1859
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 command button. when we click cmd button once the data from the notepad should be read as strings of different sizes & displayed in the text boxes....
0
7911
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6610
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
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 we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.