5 Years
Discussion Span
Last Post by Reverend Jim

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.


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.

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



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?

Edited by Reverend Jim

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.