Open문 이용한 텍스트 저장 질문합니다.

Check1을 체크하면 Text1내용이 저장되고
Check2를 체크하면 Text2내용이 저장되게 Open문 이용하려는데

밑의 예시대로 하면 저장이 되긴한데 Text1,Text2가 똑같이 뜨내요..

어떤식으로 해야 Temp.txt 파일에 둘다 저장이 되는 걸까요..

Dim FF As Byte
Dim pos As String
Option ExplicitPrivate Sub Check1_Click()

If Check1.Value = 1 Then
Open App.Path & \Temp.txt For Output As #FF
Print #FF, Text1.Text
Close #FF
Else

If Len(Dir$(App.Path & \Temp.txt)) 0 Then
Kill (App.Path & \Temp.txt)
End If

End If
End Sub

Private Sub Check2_Click()

If Check2.Value = 1 Then
Open App.Path & \Temp.txt For Output As #FF
Print #FF, Text2.Text
Close #FF
Else

If Len(Dir$(App.Path & \Temp.txt)) 0 Then
Kill (App.Path & \Temp.txt)
End If

End If
End Sub

Private Sub Form_Load()

FF = FreeFile

If Len(Dir$(App.Path & \Temp.txt)) 0 Then
Open App.Path & \Temp.txt For Input As #FF

Input #FF, pos

Text1.Text = pos
Text2.Text = pos

Close #FF

Check1.Value = 1
Check2.Value = 1

End If

End Sub

비주얼베이직 다른 글

목록