473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reading settins from .ini line for line

7
I need some help with a VB6 settings loader. I need to read text off all the lines but I only know how to do one. I am hoping to change a textbox, a checkbox and possibly the size/position of the main form.
I am using this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command11_Click()
  2. Open Text2 For Input As #1
  3. Text1.Text = Input(LOF(1), #1)
  4. Close #1
  5. If Text1 = 1 Then
  6. Check1 = Checked
  7. Else
  8. Check1 = Unchecked
  9. End If
  10. End Sub
Thank You!
Nov 18 '06 #1
4 1410
Skidlz
7
* actually I'm just going to use a .txt dunno if it matters.
Nov 18 '06 #2
albertw
267 100+
* actually I'm just going to use a .txt dunno if it matters.
hi

i don't know what you are trying to achieve with your code.

Private Sub Command11_Click()
Open Text2 For Input As #1
Text1.Text = Input(LOF(1), #1)
Close #1

you want the length of the file Text2 to be put into Text1?

Open text2 For Input As #1
Text1.Text = LOF(1)
Close #1


If Text1 = 1 Then
Check1 = Checked
Else
Check1 = Unchecked
End If

if Text1.Text=1 then check Check1?

Check1.Value=IIf(Text1.Text="1",1,0)
Nov 18 '06 #3
albertw
267 100+
hi

i don't know what you are trying to achieve with your code.

Private Sub Command11_Click()
Open Text2 For Input As #1
Text1.Text = Input(LOF(1), #1)
Close #1

you want the length of the file Text2 to be put into Text1?

Open text2 For Input As #1
Text1.Text = LOF(1)
Close #1


If Text1 = 1 Then
Check1 = Checked
Else
Check1 = Unchecked
End If

if Text1.Text=1 then check Check1?

Check1.Value=IIf(Text1.Text="1",1,0)

hi

create a form = Form1
put a textbox Text1
and a checkbox Check1

try the next code

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Load()
  3. On Error GoTo fail
  4. Open App.Path & "\settings.txt" For Input As #1
  5. Line Input #1, v
  6. p = Split(v, ",")
  7. Form1.Move p(0), p(1), p(2), p(3)
  8. Line Input #1, v
  9. Text1.Text = v
  10. Line Input #1, v
  11. Check1.Value = v
  12. fail:
  13. Close
  14. End Sub
  15.  
  16. Private Sub Form_Unload(Cancel As Integer)
  17. Open App.Path & "\settings.txt" For Output As #1
  18. Print #1, Form1.Left; ","; Form1.Top; ","; Form1.Width; ","; Form1.Height
  19. Print #1, Text1.Text
  20. Print #1, Check1.Value
  21. Close #1
  22. End Sub
  23.  
  24.  
Nov 18 '06 #4
Skidlz
7
Yes that works! I am very new/bad at VB and a simple If was the only way I could figure to check the checkbox.

Thank You!
Nov 18 '06 #5

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

Similar topics

4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
11
by: Matt DeFoor | last post by:
I have some log files that I'm working with that look like this: 1000000000 3456 1234 1000000001 3456 1235 1000020002 3456 1223 1000203044 3456 986 etc. I'm trying to read the file...
6
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am...
2
by: Sabin Finateanu | last post by:
Hi I'm having problem reading a file from my program and I think it's from a procedure I'm using but I don't see where I'm going wrong. Here is the code: public bool AllowUsage() { ...
3
by: vbnewbie | last post by:
I've been testing some of the example streamreads on 40 meg text file. I notice that it take awhile to read in debug.write and textbox1.text multi line. but if i use a textpad program, example...
4
by: Gaijinco | last post by:
I had a file named nap.in which looks like this: 4 10:00 12:00 Lectures 12:00 13:00 Lunch, like always. 13:00 15:00 Boring lectures... 15:30 17:45 Reading 4 10:00 12:00 Lectures 12:00 13:00...
10
by: Tyler | last post by:
Hello All: After trying to find an open source alternative to Matlab (or IDL), I am currently getting acquainted with Python and, in particular SciPy, NumPy, and Matplotlib. While I await the...
21
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z...
3
by: xyz | last post by:
Hi, I have a text file around 7GB includes 100 million lines... I want to read the data line by line when I approach my module.. ie., when i read for the first time , my program shuld read only...
4
by: dacuteangel04 | last post by:
ok what my program is suppost to do is open a file - Grades.txt and read each line the breaking the lines down w/ tokens so i may later average some numbers an example some of the lines from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...

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.