Computer I Chapter 03. 변수와비주얼베이직데이터형 Spring, 2015 박정근교수
03-01. 01. 변수이해하기
변수 (Variable) 변수란 데이터를저장해놓는공간 데이터나계산된결과값들이저장되는메모리공간 데이터형 / 자료형 데이터의종류및할당되는메모리크기를정함 변수선언 명시적변수선언 (explicit declaration) Dim 변수명 As 데이터형 암시적변수선언 (implicit declaration) 데이터형은가변형 (variant) 3
변수형 (Visual Basic 2010) Visual Basic type ( 변수형 ) Common language runtime type structure t Nominal storage allocation Value range Boolean Boolean Depends on implementing platform True or False Byte Byte 1 byte 0 through 255 (unsigned) Char (single character) Char 2 bytes 0 through 65535 (unsigned) Date DateTime 8 bytes Decimal Decimal 16 bytes Double (double-precision floating-point) Double 8 bytes 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999 0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9...E+28) with no decimal point; 0 through h +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; smallest nonzero number is +/-0.0000000000000000000000000001 (+/-1E-28) -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values; 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values Integer Int32 4 bytes -2,147,483,648 483 through 2,147,483,647 483 (signed) Long (long integer) Int64 8 bytes -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2...E+18 ) (signed) 4
변수형 (Visual Basic 2010) Visual Basic type ( 변수형 ) Common language runtime type structure t Nominal storage allocation Value range Object Object (class) 4 bytes on 32 -bit platform 8 bytes on 64 -bit platform Any type can be stored in a variable of type Object SByte SByte 1 byte -128 through 127 (signed) Short (short integer) Single (single-precision fl oating-point) String (variable-length) Int16 2 bytes -32,768 through 32,767 (signed) Single String (class) 4 bytes Depends on implementing platform -3.4028235E+38 through -1.401298E-45 for negative values; 1.401298E-45 through 3.4028235E+38 for positive values 0 to approximately 2 billion Unicode characters UInteger UInt32 4 bytes 0 through 4,294,967,295 (unsigned) ULong UInt64 8 bytes 0 through 18,446,744,073,709,551,615 (1.8...E+19) (unsigned) User-Defined (structure) (inherits from ValueType) Depends on implementing platform Each member of the structure has a range determined by its data type and independent of the ranges of the other members UShort UInt16 2 bytes 0 through 65,535 (unsigned) 5
형지정문자 (Type Character) 변수식별자 (Identifier type character) Identifier type character Data type Example % Integer Dim L% & Long Dim M& @ Decimal Const W@ = 37.5! Single Dim Q! # Double Dim X# $ String Dim V$ = "Secret" 6
형지정문자 (Type Character) 상수형 (Literal type characters) Default literal types Textual form of literal Default data type Example Numeric, no fractional part Integer 2147483647 Numeric, no fractional part, too large for Integer Long 2147483648 Numeric, fractional part Double 1.2 Enclosed in double quotation ti marks String "A" Enclosed within number signs Date #5/17/1993 9:32 AM# Forced literal types Literal type character Data type Example S Short I = 347S I Integer J = 347I L Long K = 347L D Decimal X = 347D Literal type character Data type Example R Double Z = 347R US UShort L = 347US UI UInteger M = 347UI UL ULong N = 347UL F Single Y = 347F C Char Q ="."C.C 7
형지정문자 (Type Character) Hexadecimal and octal literals (16 진수,8 진수 ) Number base Prefix Valid digit values Example Hexadecimal (base 16) &H 0-9 and A-F &HFFFF Octal (base 8) &O 0-7 &O77 8
변수선언 변수선언형식 Dim 변수명 As 데이터형 예제 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strcorp As String Dim ddate As Date Explicit declaration strcorp = 길벗출판사 ddate = #1/1/2002# strname = 홍길동 Implicit declaration End Sub MsgBox strcorp & vbcr & ddate & vbcr & strname 명시적선언옵션 Option Explicit On Private Sub Button1_Click(...) Handles Button1.Click... End Sub 9
변수이름규칙 변수이름규칙 대소문자구분없음 첫번째문자는반드시숫자가아닌문자 밑줄 (_) 이외에공백이나마침표 (.), 느낌표 (!), @, &, $, #, -등의특수문자는사용할수없음 길이는 256 자를넘을수없음 함수, 문, 메서드등키워드와같은이름을사용할수없음 같은수준의범위에서는이름을중복해서지정할수없음 같은프로시저안에같은이름의변수두개선언불가 같은모듈안에서 Private 변수와프로시저수준의변수는이름이같을수있음 가능한변수이름 잘못된변수이름 in_data in-data 특수문자 가사용된 Data_1 1_Data 숫자로시작함 Data[1] Date 특수문자 [] 가사용됨 함수명 Date 를사용함 10
변수에값대입하기 대입문 등호 (=) 사용 오른쪽의내용을왼쪽변수에대입 자동형변환 되도록자동형변환을사용하지말것 형변환함수사용 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strname As String strname = 홍길동 strname = strname & 20101 End Sub MsgBox strname 자동형변환 11
변수선언과초기화 선언과동시에초기화하기 Dim 변수명 As 데이터형 = 초기값 예제 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As Integer = 2015 Dim strcorp As String = 길벗출판사 Dim ddate As Date = #1/1/2002# End Sub 12
03-02. 02. 수치데이터형다루기
수치데이터형 수치데이터형 계산이가능한수치데이터를다루는데이터형 계산결과가데이터형이표현하는최대값을넘어가면오버플로우발생 (overflow) 수치데이터형의종류 정수형 정수데이터만저장 Byte, Integer, Long, SByte, Short, UInteger 등 데이터형에따라데이터의범위 ( 최소, 최대값 ) 이다름 실수형 실수데이터를저장 Single, Double 등 데이터형에따라정밀도 (precision), 범위가다름 14
예제 목적 정수형데이터선언 오버플로우발생시오류메시지확인 실수를정수형데이터에대입했을때결과값확인 실행내용 두수를입력받아곱하고나누었을때계산결과를표시 두수를정수형변수에보관하여계산 15
폼디자인 컨트롤속성 (Visual Basic 2010) 번호종류속성 1 Form Text: 정수형변수 2 Label Text: A의값 3 Label Text: B의값 4 TextBox (Name): txta 5 TextBox (Name): txtb 6 TextBox (Name): ttot txtout Locked: True TabStop: False 7 Button (Name): cmdmul Text: A * B 결과 8 Button (Name): cmddiv Text: A / B 결과 16
이벤트 17
03-03. 03. 문자열데이터다루기 03-04. 04. 날짜와시간데이터다루기
문자열데이터 문자열 (string) 데이터 문자의나열 유니코드문자로저장됨 문자열변수선언 Dim 변수명 As String Visual basic 2010 에서는고정길이문자열을지원하지않음 문자열상수 따옴표 ( ) 로묶여있는문자열 예 ) string, 문자열, Visual Basic 2010 19
예제 목적 문자열과관련된함수와문자를다른데이터형으로변환하는함수의사용법배움 실행내용 주민등록번호를입력받아년, 월, 일부분으로나누어서날짜형으로표시 탄생일과현재까지살아온날수를계산 주민등록번호를여섯자리이하로입력하면주민등록번호를입력하라는입력안내메시지창표시 20
폼디자인 TextBox txtjumin, txtyear, txtmonth, txtday, txtweek, txtnalsu 21
코드 22
사용문법 조건문 If ~ Then ~ End If 4장제어문과배열에서다룸 객체이름생략 With ~ End With. 으로시작하면자동으로 With에서지정한객체이름으로인식 With txtjumin txtjumin.text = 111111-1234567.Text = 111111-1234567 End With Fully qualified name 각함수는이름공간 (namespace) 을함께기술하여모호함을없앨수있음 예 ) left() Microsoft.VisualBasic.left() 23
Namespace: Microsoft.VisualBasic Action Compare two strings. Convert strings. 문자열관련함수 Language g element StrComp StrConv Reverse a string. InStrRev, StrReverse Convert to lowercase or uppercase. Create a string of repeating characters. Find the length of a string. Format a string. Manipulate strings. Set string comparison rules. Work with ASCII and ANSI values. Replace a specified substring. Return a filter-based string array. Return a specified number of substrings. Format, LCase, UCase Space, StrDup Len Format, FormatCurrency, FormatDateTime, FormatNumber, FormatPercent InStr, Left, LTrim, Mid, Right, RTrim, Trim Option Compare Asc, AscW, Chr, ChrW Replace Filter Split, Join 24
문자열 / 날짜포멧팅 Format 함수 Strings.Format() MSDN 매뉴얼참조 https://msdn.microsoft.com/enus/library/microsoft.visualbasic.strings.format.aspx 25
Namespace: Microsoft.VisualBasic 날짜와시간관련변수 Name Description DateString Returns or sets a String value representing the current date according to your system. Now TimeOfDay Timer TimeString Today Returns a Date value containing the current date and time according to your system. Returns or sets a Date value containing the current time of day according to your system. Returns a Double value representing the number of seconds elapsed since midnight. Returns or sets a String value representing the current time of day according to your system. Returns or sets a Date value containing the current date according to your system. 26
Namespace: Microsoft.VisualBasic 날짜와시간관련함수 Name DateAdd(DateInterval, Double, DateTime) DateAdd(String, Double, Object) DateDiff(DateInterval, DateTime, DateTime, FirstDayOfW eek, FirstWeekOfYear) DateDiff(String, Object, Object, FirstDayOfWeek, FirstWe ekofyear) DatePart(DateInterval, DateTime, FirstDayOfWeek, First WeekOfYear) DatePart(String, Object, FirstDayOfWeek, FirstWeekOfYe ar) DateSerial DateValue Day Equals(Object) Description Returns a Date value containing a date and time value to which a specified time interval has been added. Returns a Date value containing a date and time value to which a specified time interval has been added. Returns a Long value specifying the number of time intervals between two Date values. Returns a Long value specifying the number of time intervals between two Date values. Returns an Integer value containing the specified component of a given Date value. Returns an Integer value containing the specified component of a given Date value. Returns a Date value representing a specified year, month, and day, with the time information set to midnight (00:00:00). Returns a Date value containing the date information represented by a string, with the time information set to midnight (00:00:00). Returns an Integer value from 1 through 31 representing the day of the month. Determines whether the specified Object is equal to the current Object. (Inherited from Object.) 27
Namespace: Microsoft.VisualBasic 날짜와시간관련함수 Name GetHashCode GetType Hour MemberwiseClone Minute Month MonthName Second TimeSerial TimeValue ToString Weekday WeekdayName Year Description Serves as a hash function for a particular type. (Inherited from Object.) Gets the Type of the current instance. (Inherited from Object.) Returns an Integer value from 0 through 23 representing the hour of the day. Creates a shallow copy of the current Object. (Inherited from Object.) Returns an Integer value from 0 through 59 representing the minute of the hour. Returns an Integer value from 1 through 12 representing the month of the year. Returns a String value containing the name of the specified month. Returns an Integer value from 0 through 59 representing the second of the minute. Returns a Date value representing a specified hour, minute, and second, with the date information set relative to January 1 of the year 1. Returns a Date value containing the time information represented by a string, with the date information set to January 1 of the year 1. Returns a string that represents the current object. (Inherited from Object.) Returns an Integer value containing a number representing the day of the week. Returns a String value containing the name of the specified weekday. Returns an Integer value from 1 through 9999 representing the year. 28
Namespace: Microsoft.VisualBasic Function name Return data type 형변환함수 Range for expression argument CBool Boolean Data Type (Visual Basic) Any valid Char or String or numeric expression. CByte Byte Data Type (Visual Basic) 0 through 255 (unsigned); fractional parts are rounded.1 CChar Char Data Type (Visual Basic) Any valid Char or String expression; only first character of a String is c onverted; value can be 0 through 65535 (unsigned). CDate Date Data Type (Visual Basic) Any valid representation of a date and time. -1.79769313486231570E+308 through -4.94065645841246544E-324 f CDbl Double Data Type (Visual Basic) or negative values; 4.94065645841246544E-324 through 1.797693134 86231570E+308 for positive values. CDec Decimal Data Type (Visual Basic) +/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. For numbers with 28 decimal places, the range is +/-7.9228162514264337593543950335. The smallest possible non-zero number is 0.0000000000000000000000000001 (+/-1E-28). CInt Integer Data Type (Visual Basic) -2,147,483,648 through 2,147,483,647; fractional parts are rounded.1 CLng Long Data Type (Visual Basic) CObj Object Data Type Any valid expression. -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807; fractional parts are rounded.1 CSByte SByte Data Type (Visual Basic) -128 through h 127; fractional parts are rounded.1 d CShort Short Data Type (Visual Basic) -32,768 through 32,767; fractional parts are rounded.1 29
Namespace: Microsoft.VisualBasic Function name CSng CStr Return data type Single Data Type (Visual Basic) String Data Type (Visual Basic) 형변환함수 Range for expression argument -3.402823E+38 through -1.401298E-45 for negative values; 1.401298E-45 through 3.402823E+38 for positive values. Returns for CStr depend on the expression argument. See Return Values for the CStr Function (Visual Basic). CUInt UInteger Data Type 0 through 4,294,967,295 (unsigned); fractional parts are rounded.1 CULng ULong Data Type (Visual Basic) 0 through 18,446,744,073,709,551,615 (unsigned); fractional parts are rounded.1 CUShort UShort Data Type (Visual Basic) 0 through 65,535 (unsigned); fractional parts are rounded.1 30
03-06. 06. 선언키워드에따른변수의사용범위
변수의범위 (Scope and Extent) 변수사용범위 (Scope) 프로젝트범위 프로젝트내의모든프로시저내에서사용가능 모듈 (Module, Class, Structure) 범위 모듈내의프로시저에서만사용가능 프로시저범위 정의된프로시저내에서만사용가능 블록범위 정의된블록내에서만사용가능 변수유지범위 (Extent) 프로그램종료시까지 프로시저종료시까지 32
변수의범위 Project Module1 Public global_var As Type Dim module_var1 As Type Private module_var2 As Type Private Sub proceduer1() Dim local_var1 As Type Module2 Dim module_var3 As Type Private Sub procedure3() Static local_var3 As Type... End Sub If condition Then Dim block_var1 As Type... End If End Sub Private Sub procedure2() Dim local_var2 As Type... End Sub 33
변수의범위 Project Module1 Public global_var As Type Dim module_var1 As Type Private module_var2 As Type Private Sub proceduer1() Dim local_var1 As Type Module2 Dim module_var3 As Type Private Sub procedure3() Static local_var3 As Type... End Sub If condition Then Dim block_var1 As Type... End If End Sub Private Sub procedure2() Dim local_var2 As Type... End Sub 34
변수의범위 Project Module1 Public global_var As Type Dim module_var1 As Type Private module_var2 As Type Private Sub proceduer1() Dim local_var1 As Type Module2 Dim module_var3 As Type Private Sub procedure3() Static local_var3 As Type... End Sub If condition Then Dim block_var1 As Type... End If End Sub Private Sub procedure2() Dim local_var2 As Type... End Sub 35
변수의범위 Project Module1 Public global_var As Type Dim module_var1 As Type Private module_var2 As Type Private Sub proceduer1() Dim local_var1 As Type Module2 Dim module_var3 As Type Private Sub procedure3() Static local_var3 As Type... End Sub If condition Then Dim block_var1 As Type... End If End Sub Private Sub procedure2() Dim local_var2 As Type... End Sub 36
변수의범위 변수유변수종류변수의범위선언설명지범위 지역변수 (local variable) 모듈변수 전역변수 (global variable) 프로시저수준 모듈수준 프로젝트수준 프로시저종료 프로그램종료 프로그램종료 Static 변수프로시저수준프로그램종료 Dim Private or Dim Public Static 프로시저호출때마다초기값이 Empty 로설정 프로그램종료시까지값이유지 프로그램종료시까지값이유지 프로그램종료시까지값이유지 37
예제 38
03-07. 07. 비주얼베이직연산자의종류
연산자 (Operator) 의종류 산술연산자 (Arithmetic Operator) 숫자값계산을수행 더하기 (+), 빼기 (-), 곱하기 (*), 나누기 (/) 등 비교연산자 두식을비교하여비교결과를나타내는 Boolean 값을반환 같다 (=), 크다 (>), 작다 (<), 같지않다 (<>) 등 논리및비트연산자 Boolean 또는숫자값을결합하여동일한데이터형으로결과값을반환 논리곱 (And), 논리합 (Or) 등 40
산술연산자 연산자연산자이름기능형식요소데이터형사용예 ^ 지수 지수값계산 num ^ exp num: 숫자식 exp: 숫자식결과값 : Double +, - 양수 / 음수부호숫자식의양 +exp1 ( 단항 ) 수 / 음수값 -exp1 exp1: 숫자식 *, / 곱셈, 나눗셈 \ 정수나눗셈 Mod 나머지연산 +, - 덧셈, 뺄셈 곱셈, 나눗셈 exp1 * exp2 exp1: 숫자식 계산 exp1 / exp2 exp2: 숫자식 나눗셈의몫을계산 exp1 \ exp2 exp1: 숫자식 exp2: 숫자식 나눗셈의나머지계산 exp1 Mod exp2 exp1: 숫자식 exp2: 숫자식 덧셈, 뺄셈계산 exp1 + exp2 exp1 exp2 exp1: 숫자식 exp2: 숫자식 Dim exp1 As Double exp1 = 2 ^ 2 val =+3 val = -3 Dim val1 As Integer Dim val2 As Double val1 = 2 * 2 val1 = 3 / 2 val2 = 3 / 2 Dim val As Integer val = 11 \ 4 Dim val1 As Integer Dim val2 As Double val1 = 11 Mod 4 val2 = 5 Mod 2.2 Dim val As Integer val = 1 + 3 val = 5 2 41
비교연산자 비교결과 ( 결과값 : Boolean) 연산자 결과가 True인조건 결과가 False인조건 < ( 보다작음 ) expression1 < expression2 expression1 >= expression2 <= ( 작거나같음 ) expression1 <= expression2 expression1 > expression2 > ( 보다큼 ) expression1 > expression2 expression1 <= expression2 >= ( 크거나같음 ) expression1 >= expression2 expression1 < expression2 = ( 같음 ) expression1 = expression2 expression1 <> expression2 <> ( 같지않음 ) expression1 <> expression2 expression1 = expression2 문자열비교 사전순으로계산 ex) A < B : True, Visual < Basic : False 42
비교연산자 기타비교연산자 비교연산자형식기능예제 문자열패턴비교 Like string Like pattern 문자열과패턴을비교 F Like FFF abbba Lik Like a*a F Like [A-Z] a2a Like a#a 객체비교 Is object1 Is object2 두객체참조가같은지비교 IsNot object1 IsNot object2 두객체참조가다른지비교 Dim val As Boolean Dim obj1, obj2 As Object val = obj1 Is obj2 val = obj1 IsNot obj2 패턴표현식 pattern의문자 string의일치대상? 임의의단일문자 * 0개이상의문자 # 임의의단일숫자 (0 9) [ charlist ] charlist 에있는임의의단일문자 [! charlist ] charlist에없는임의의단일문자 43
논리연산자 두 Boolean 식에대한연산 연산자명칭포멧결과가 True 인조건 Not 논리부정 Not exp1 exp1 이 False 일때 And 논리곱 exp1 And exp2 exp1 과 exp2 가모두 True 일때 Or 논리합 exp1 Or exp2 exp1 또는 exp2 가 True 일때 Xor 배타적논리합 exp1 Xor exp2 exp1 만 True 또는 exp2 만 True 일때 논리표 exp1 exp2 Not exp1 exp1 And exp2 exp1 Or exp2 exp1 Xor exp2 True True False True True False True False False False True True False True True False True True False False True False False False 44
비트연산자 논리연산자와같으나수식이올경우비트단위로계산 exp1 bit exp2 bit Not exp1 exp1 And exp2 exp1 Or exp2 exp1 Xor exp2 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 0 Bit 단위로계산 00100001 00000001 And 00000011 Or 00000010 ----------------- --------------- 00000001 00000011 45
연산자우선순위 산술연산자 비교연산자 논리연산자 산술연산자, 논리연산자는테이블위쪽부터우선순위 비교연산자는모두동일우선순위 왼쪽부터계산 (left-to-right) Arithmetic Comparison Logical Exponentiation (^) Equality (=) Not Negation ( ) Inequality (<>) And Multiplication and division (*, /) Less than (<) Or Integer division (\) Greater than (>) Xor Modulus arithmetic (Mod) Less than or equal to (<=) Eqv Addition and subtraction (+, ) Greater than or equal to (>=) Imp String concatenation (&) Like, Is 46
연산자우선순위 예제 Not 6 > 5 And (2 + 5) * 3 4 3 5 1 2 1. Arithmetic +: () 안에있는연산우선 2. Arithmetic *: Arithmetic 연산우선 3. Comparison >: Comparison 연산우선 4. Logical Not 5. Logical And 47
03-08. 08. 상수이해하기
상수 상수 변함없이동일한값을가지는변수 값을수정할수없음 소스를이해하기쉽고수정하기편리하게함 상수의종류 내장상수 vb 로시작 ( 예 : vbyellow, vbblack, vbcr,...) 사용자정의상수 Const 상수명 As 데이터형 = 상수값 예 ) Const coursename As String = Computer1 49
03-09. 09. MsgBox 와 InputBox 이용하기
MsgBox 형식 response = MsgBox(prompt [, buttons] [, title]) response: 대화상자의반환값 (MsgBoxResult) prompt: 대화상자안에표시될내용 buttons: 버튼및아이콘모양 (MsgBoxStyle) title: 대화상자의제목에표시될내용 MsgBoxStyle 멤버 값 설명 버튼의개수와유형 OKOnly 0 확인단추만표시합니다. OKCancel 1 확인및취소단추를표시합니다. AbortRetryIgnore 2 중단, 다시시도및무시단추를표시합니다. YesNoCancel 3 예, 아니요및취소단추를표시합니다. YesNo 4 예및아니요단추를표시합니다. RetryCancel 5 다시시도및취소단추를표시합니다. 51
MsgBox MsgBoxStyle 멤버값설명 아이콘스타일 Critical 16 중대오류메시지아이콘을표시합니다. Question 32 경고쿼리아이콘을표시합니다. Exclamation 48 경고메시지아이콘을표시합니다. Information 64 정보메시지아이콘을표시합니다. 기본버튼 DefaultButton1 0 첫째단추가기본값입니다. DefaultButton2 256 둘째단추가기본값입니다. DefaultButton3 512 셋째단추가기본값입니다. 모달 ApplicationModal 0 SystemModal 4096 기타 응용프로그램이모달입니다. 현재사용중인응용프로그램에서작업을계속하려면먼저메시지상자에응답해야합니다. 시스템이모달입니다. 메시지상자에응답할때까지모든응용프로그램이일시중단됩니다. MsgBoxSetForeground 65536 메시지상자창을전경창으로지정합니다. MsgBoxRight 524288 텍스트를오른쪽에맞춥니다. MsgBoxRtlReading 1048576 히브리어와아랍어시스템에서처럼오른쪽에서왼쪽으로텍스트를읽도록지정합니다. 52
MsgBox 예제 MsgBox( Message, MsgBoxStyle.OkCancel Or MsgBoxStyle.Critical) 반환값 Dim response As MsgBoxResult response = MsgBox( Message, g MsgBoxStyle.OkCancel) MsgBoxResult.OK, MsgBoxResult.Cancel, MsgBoxResult.Abort, MsgBoxResult.Retry, MsgBoxResult.Ignore, MsgBoxResult.Yes, MsgBoxResult.No 53
InputBox 형식 inputval = InputBox(prompt [, title] [, default] [, xpos] [, ypos]) prompt: 대화상자안에표시될내용 (String) title: 대화상자의제목에표시될내용 (String) default: 대화상자텍스트박스에표시될초기값 (String) xpos: 대화상자가표시될수평위치 ypos: 대화상자가표시될수직위치 예제 Dim strmsg As String strmsg tm = InputBox( 자료를입력해주세요, 입력, 100) 54