Hi,

I WANT TO WRITE/READ DATA IN PARTICULAR COLUMN NO. IN NOTEPAD BY USING VB 6.0.
CAN ANYBODY SEND ME THE CODING FOR THAT.

Recommended Answers

All 6 Replies

That could actually be very difficult, depending on what font you use in Notepad.exe. Some fonts are variable width so that the letter M is a lot wider then the letter I. If you use a fixed-width font then your problem becomes a lot easier, just count the number of characters up to the column you want.

what efforts did you made to solve this issue . . . ?

Here is my code

Open Path & ("d:/rohit.txt") For Append As #1
Print #1, TextBox1.Text; Space(1); TextBox3.Text; Space(10); TextBox2.Text; Space(12); TextBox4.Text; TextBox5.Text; TextBox6.Text; Space(7);

Close #1

In this case I use space but the column no. will changed for different projects. Space function takes so much time.

eg.
If I write 1 in textbox & I click on command button then that value will automatically go on column no. 12 in notepad.

@rohit.dudhbhate

A few things:-
Are you using spaces in the file as a column separator ?, if yes then you shouldn't go with this because it will not do any meaningful.
.
lets see ex:-
(text1.text="Any string") and Next time it may be(text1.text="Entire Line with group of strings") then it will write to file as:-

Any string
Entire Line with group of strings

as you put one space as separator, so here you cant identify(for further uses) that what is next(text3.text) because the second line has a lot spaces.

Space function takes so much time

if it takes really then you should go with vbTab

at last you should use something different character as a column separator rather than using space .

Your question seems to say you want to control Notepad from within VB but your code implies you only want to modify a text file. Which is it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.