이 기사의 예에서는 VB를 사용하여 txt 파일을 열고 저장하는 방법을 설명합니다. 참고할 수 있도록 모든 사람과 공유하세요. 세부사항은 다음과 같습니다:
Private Sub cmdsave_Click()Dim filelocation As String' 로드 상자로 저장 commondialog1.ShowSave filelocation = commondialog1.FileName' 지원하는 경우 파일 위에 저장 Open filelocation For Append As #1 Print #1, text1.text Close #1End SubPrivate Sub cmdopen_Click ()Dim filelocation As String' 열기 상자 표시 commondialog1.ShowOpen 파일 위치 = commondialog1.FileName' 입력 파일을 text1.text로 열기 파일 위치 열기 다음으로 입력 #1Do Until EOF(1) 입력 #1, 데이터 text1.text = text1.text + Data + vbNewLine EOF (1) 루프 닫기 #1End Sub
이 글이 모든 사람의 VB 프로그래밍에 도움이 되기를 바랍니다.