Global It Leader!!



 
 

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

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 1건 조회 8,113회 작성일 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>

전체 440
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
220 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7469 06-25
219 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8034 06-25
218 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13005 06-24
217 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8539 06-24
216 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9231 06-17
215 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 24954 07-22
214 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9922 07-21
213 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8411 07-21
212 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8725 07-21
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8114 07-20
210 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10036 07-15
209 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8110 07-14
208 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7421 07-14
207 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8897 07-13
206 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8962 07-13
205 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7568 07-08
204 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7251 07-08
203 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8598 07-08
202 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8090 07-08
201 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7887 07-08