Const? File name? =? " c:\ 1.txt "? Change the file name yourself.
Dim? Text_ 1? As? line
Dim? Text_2? As? line
Private? Sub? Read()? Read in file
You can read this file in a form loading event or a button event:
Dim? Document number? As? integer
Document number? =? Free file
Open? File name? For what? Input? As? # Document number
Dim? Stirling? As? line
Do what? Until? File number
Line? Input? # Document number,? Stirling
File buffer. Supplement? Stirling
Cycle? Read a file line into the collection
Text 1? =? Split (file buffer. Item (3)? "=")( 1)
Text2? =? Split (file buffer. Item (4)? "=")( 1)? Write text box
Text_ 1? =? Text 1
Text_2? =? Text 2
Close? # Document number
End? submarine
-
Private? Sub? Save()? save a file
Dim? a
Answer? =? Split (file buffer. Item (3)? "=")
a( 1)? =? Text 1
File buffer. Remove? three
File buffer. Supplement? By adding (a,? "="),? ,? three
Answer? =? Split (file buffer. Item (4)? "=")
a( 1)? =? Text 2
File buffer. Remove? four
File buffer. Supplement? By adding (a,? "="),? ,? four
Dim? Document number? As? integer
Document number? =? Free file
Open? File name? For what? Output? As? # Document number
Dim? Me? As? integer
For what? Me? =? 1? Where to? File buffer. count
Print? # Document number,? File buffer. Project (1)
then
Close? # Document number
End? submarine
-
Private? Sub? Form_Load()?
Reading? It can also be read in the button event.
End? submarine
-
Private? Sub? Form_Unload (Cancel? As? Integer)
What if? Text 1? & lt& gt? Text_ 1? Or? Text2? & lt& gt? Text_2? then what rescue
End? submarine
-
Private? Sub? Text 1_Validate (Cancel? As? Boolean type)
What if? Text 1? & lt& gt? Text_ 1? then
rescue
Text_ 1? =? Text 1
End? if
End? submarine
-
Private? Sub? Text2_Validate (cancel? As? Boolean type)
What if? Text2? & lt& gt? Text_2? then
rescue
Text_2? =? Text 2
End? if
End? If the file is updated only when the window is closed, set the text box CausesValidation to false, otherwise set it to true.