读入文件
mycalc中的 history 函数
Private Sub history_Click()
Dim str$
Open App.Path & "\history.txt" For Input As #1
Do Until EOF(1)
Input #1, str
Text1.Text = Text1.Text & str & vbCrLf
Loop
Close #1
End Sub
输出文件
mycast_module1
'============================导出文件=========================
Private Sub Command1_Click()
On Error GoTo Cancel
' CommonDialog1.FileName = App.Path & "\mesh.txt"
' CommonDialog1.DefaultExt = "txt"
CommonDialog1.FileName = "mesh"
CommonDialog1.InitDir = App.Path
CommonDialog1.Filter = "Plain text(*.txt)|*.txt|Markdown(*.md)|*.md"
CommonDialog1.FilterIndex = 1
CommonDialog1.CancelError = True
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, String(10, "#")
Print #1, "InitMesh"
Print #1, "L: "; L
Print #1, "Δx: "; Dx
Print #1, "Δy: "; Dy
Print #1,
Print #1, String(10, "#")
Print #1, "Materials"
Print #1, Combo1.Text
Print #1, Combo2.Text
Print #1, Combo3.Text
Print #1, Combo4.Text
Print #1,
Print #1, String(10, "#")
Print #1, "Model&Material"
For j = L - Dy / 2 To Dy / 2 Step -Dy
For i = Dx / 2 To L - Dx / 2 Step Dx
Select Case Pic.Point(i, j) '注意不要缺省 Point方法的对象
Case Color0.BackColor
Print #1, "0 ";
Case Color1.BackColor
Print #1, "1 ";
Case Color2.BackColor
Print #1, "2 ";
Case Color3.BackColor
Print #1, "3 ";
Case Color4.BackColor
Print #1, "4 ";
End Select
Next i
Print #1, '换行
Next j
Close #1
Exit Sub
Cancel:
End Sub