Global It Leader!!



 
 

VB VB 2008 텍스트 박스 엔터키 처리 예제

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 1건 조회 8,112회 작성일 10-07-20 12:09

본문

Private Sub txt출고_자재번호_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt출고_자재번호.KeyPress

        If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
            If 자재코드조회(txt출고_자재번호.Text, "출고") = False Then
                Exit Sub
            End If
            Call 출고등록()
            Exit Sub
        End If

    End Sub

출처 : 데브피아

[이 게시물은 오원장님에 의해 2013-02-28 16:42:18 오피스팁에서 이동 됨]

댓글목록

오원장님의 댓글

no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일

<P>마이크로 소프트사 예제 <BR><BR>다음 예제에서는 TextBox 컨트롤을 만듭니다. keypressed 메서드는 KeyChar 속성을 사용하여 Enter 키를 눌렀는지 여부를 확인합니다. ENTER 키를 눌렀으면 Handled 속성이 true로 설정되어 이벤트가 처리됨을 나타냅니다.</P>
<DIV style="BORDER-BOTTOM: #ff80c2 1px solid; BORDER-LEFT: #ff80c2 1px solid; PADDING-BOTTOM: 5px; BACKGROUND-COLOR: #ffdaed; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; BORDER-TOP: #ff80c2 1px solid; BORDER-RIGHT: #ff80c2 1px solid; PADDING-TOP: 5px"><SPAN style="COLOR: blue">Imports</SPAN> System
<SPAN style="COLOR: blue">Imports</SPAN> System.Windows.Forms<BR><BR><SPAN style="COLOR: blue">Public</SPAN> <SPAN style="COLOR: blue">Class</SPAN> Form1<BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">Inherits</SPAN> Form<BR><BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">Public</SPAN> <SPAN style="COLOR: blue">Sub</SPAN> <SPAN style="COLOR: blue">New</SPAN>()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">' Create a TextBox control.</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">Dim</SPAN> tb <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: blue">New</SPAN> TextBox()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">Me</SPAN>.Controls.Add(tb)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">AddHandler</SPAN> tb.KeyPress, <SPAN style="COLOR: blue">AddressOf</SPAN> keypressed<BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">End</SPAN> <SPAN style="COLOR: blue">Sub</SPAN> <SPAN style="COLOR: green">'New</SPAN><BR><BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">Private</SPAN> <SPAN style="COLOR: blue">Sub</SPAN> keypressed(<SPAN style="COLOR: blue">ByVal</SPAN> o <SPAN style="COLOR: blue">As</SPAN> [<SPAN style="COLOR: blue">Object</SPAN>], <SPAN style="COLOR: blue">ByVal</SPAN> e <SPAN style="COLOR: blue">As</SPAN> KeyPressEventArgs)
        <SPAN style="COLOR: green">' The keypressed method uses the KeyChar property to check </SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">' whether the ENTER key is pressed. </SPAN><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">' If the ENTER key is pressed, the Handled property is set to true, </SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">' to indicate the event is handled.</SPAN><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">If</SPAN> e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.<SPAN style="COLOR: blue">Return</SPAN>) <SPAN style="COLOR: blue">Then</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Handled = <SPAN style="COLOR: blue">True</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">End</SPAN> <SPAN style="COLOR: blue">If</SPAN><BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">End</SPAN> <SPAN style="COLOR: blue">Sub</SPAN> <SPAN style="COLOR: green">'keypressed</SPAN><BR><BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">Public</SPAN> <SPAN style="COLOR: blue">Shared</SPAN> <SPAN style="COLOR: blue">Sub</SPAN> Main()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Application.Run(<SPAN style="COLOR: blue">New</SPAN> Form1())<BR>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">End</SPAN> <SPAN style="COLOR: blue">Sub</SPAN> <SPAN style="COLOR: green">'Main</SPAN><BR><SPAN style="COLOR: blue">End</SPAN> <SPAN style="COLOR: blue">Class</SPAN> <SPAN style="COLOR: green">'Form1</SPAN><BR></DIV>
<P><BR>&nbsp;</P>

전체 95
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
55 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6322 12-16
54 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4449 11-14
53 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8855 11-05
52 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4623 10-24
51 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7111 10-24
50 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4662 07-26
49 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4744 03-09
48 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4910 03-09
47 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10842 06-30
46 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6707 06-25
45 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7468 06-25
44 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8033 06-25
43 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13004 06-24
42 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8538 06-24
41 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9230 06-17
40 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 24953 07-22
39 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9921 07-21
38 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8410 07-21
37 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8724 07-21
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8113 07-20