1 Replies - 1066 Views - Last Post: 24 April 2014 - 12:39 AM Rate Topic: -----

#1 wlagat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-April 14

Saving text box values to atext file at specific positions

Posted 07 April 2014 - 05:33 AM

Hallo! am writing a program that a user inputs data in 9 text boxes , i want this data be saved in a text file which i have achieved,
the problem is i want each text box value be written at specific positions for example textbox 1 has a 3 characters i want it written om line 1 at postion 1 , textbox2 has 10charecters i want it written at potion 5 on line 1,
help me know how to Go around this ,
Regards
Is This A Good Question/Topic? 0
  • +

Replies To: Saving text box values to atext file at specific positions

#2 StuckWithVB6  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-April 14

Re: Saving text box values to atext file at specific positions

Posted 24 April 2014 - 12:39 AM

' This is kinda brute force but will work. There are better ways to store the data. For sequential 
' text files, I like to write tab delimited so I can use the Split function when reading it back.

	open "c:\dum\anyfile.txt" for output as #1
	Print #1, left$(txtBox1 + space(4),4);		'Box 1 starting in position 1 for len=4
	Print #1, left$(txtBox2 + space(10),10);	'Box 2 starting in position 5 for len=10
	***
	***
	Print #1, left$(txtBox9 + space(4),4)		'Box 10 using 4 bytes - no semicolon at end so we get a CrLf
	close #1


'Another option



This post has been edited by andrewsw: 24 April 2014 - 03:58 AM
Reason for edit:: Fixed code tags

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1