NET Framework Library에 있는 StreamReader Class를 이용했음.
StreamReader Class
StreamReader 클래스를 이용하기 위해서는 코드 맨 상단에 Imports System.IO 를
추가해 준다.
폼디자인
코딩하기
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim StreamToDisplay As StreamReader
'읽을 txt 파일을 할당
StreamToDisplay = New StreamReader("E:\test.txt")
'파일 끝까지 읽어서 그 데이터를 txtRead.Text에 입력하라
txtRead.Text = StreamToDisplay.ReadToEnd
'StreamReader 객체를 닫고 관련 리소스를 release하라.
StreamToDisplay.Close()
End Sub
End Class
test.txt 파일의 내용은 RFC5090의 첫머리를 저장한 것이다.
Network Working Group B. Sterman
Request for Comments: 5090 Kayote Networks
Obsoletes: 4590 D. Sadolevsky
Category: Standards Track SecureOL, Inc.
D. Schwartz
Kayote Networks
D. Williams
Cisco Systems
W. Beck
Deutsche Telekom AG
February 2008
RADIUS Extension for Digest Authentication
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Abstract
This document defines an extension to the Remote Authentication
Dial-In User Service (RADIUS) protocol to enable support of Digest
Authentication, for use with HTTP-style protocols like the Session
Initiation Protocol (SIP) and HTTP.
실행하기
이상으로 StreamReader 클래스를 이용해서 간단하게 txt파일을 읽어오는 법을 알아보았다.
'컴퓨터 관련 무료강좌 > 비주엘 베이직 2008' 카테고리의 다른 글
VB2008-시스템에 설치된 드라이브 정보보기 (0) | 2008.04.17 |
---|---|
VB2008 강좌- 반복문(For Next, Do문) (0) | 2008.03.26 |
VB2008 강좌-Select Case문 (0) | 2008.03.25 |
VB2008 강좌-If 조건문 (0) | 2008.03.24 |
VB2008 강좌- 연산자 (0) | 2008.03.23 |