Class Window 1 ' WPF 두 번 째 예제 프로그램 ' 프 그램 명 : 구구단 프로그램 ' 제 작 일 : 2010 . 01 . 02 Private Sub Window 1 _ Loaded ( ByVal sender As System . Object , ByVal e As System . Windows . RoutedEventArgs ) Handles MyBase . Loaded Me . Title = "< 구구단 프로그램 >" TextBox 1 . Text = "" Button 1 . Content = " 확 인 " Button 2 . Content = " 종 료 " Label 1 . Content = "" TextBox 1 . Focus ( ) End Sub Private Sub Button 1 _ Click ( ByVal sender As System . Object , ByVal e As System . Windows . RoutedEventArgs ) Handles Button 1 . Click Dim a As Integer Label 1 . Content = "" If IsNumeric ( TextBox 1 . Text ) = False Then Label 1 . Content = " 숫자 입력 만 가능 합니다 . " Exit Sub Else a = TextBox 1 . Text End If Call kubsum ( a ) End Sub Private Sub kubsum ( ByVal a As Integer ) Dim i As Integer = 1 Dim c As Integer = 0 For i = 1 To 9 c = CInt ( a ) * i Label 1 . Content = Label 1 . Content & a & " * " & i & " = " & c & vbCrLf Next End Sub Private Sub TextBox 1 _ KeyDown ( ByVal sender As Object , ByVal e As System . Windows . Input . KeyEventArgs ) Handles TextBox 1 . KeyDown Dim a As Integer Label 1 . Content = "" If e . Key = Key . Enter Then If IsNumeric ( TextBox 1 . Text ) = False Then Label 1 . Content = " 숫자 입력 만 가능 합니다 . " Exit Sub Else a = TextBox 1 . Text End If Call kubsum ( a ) End If End Sub Private Sub Button 2 _ Click ( ByVal sender As System . Object , ByVal e As System . Windows . RoutedEventArgs ) Handles Button 2 . Click Me . Close ( ) End End SubEnd Class xaml source : < Window x : Class =" Window 1 " xmlns =" http : / / schemas . microsoft . com / winfx / 2006 / xaml / presentation " xmlns : x =" http : / / schemas . microsoft . com / winfx / 2006 / xaml " Title =" Window 1 " Height =" 342 " Width =" 300 "> < Grid > < Grid Margin =" 8 , 9 , 8 , 16 " Name =" Grid 1 " ForceCursor =" False " ShowGridLines =" False " OverridesDefaultStyle =" True "> < Grid . RowDefinitions > < RowDefinition Height =" 29 *" / > < RowDefinition Height =" 217 *" / > < RowDefinition Height =" 27 *" / > < RowDefinition Height =" 6 *" / > </ Grid . RowDefinitions > < Button HorizontalAlignment =" Right " Margin =" 0 , 0 , 18 , 0 " Name =" Button 1 " Width =" 87 "> Button </ Button > < TextBox Margin =" 31 , 5 , 0 , 1 " Name =" TextBox 1 " TextAlignment =" Center " H orizontalContentAlignment =" Center " Foreground =" Blue " HorizontalAlignment =" Left " Width =" 70 " / > < Label Grid . Row =" 1 " Margin =" 4 , 6 , 6 , 0 " Name =" Label 1 " Grid . RowSpan =" 2 " Foreground =" Blue "> Label </ Label > < Button Grid . Row =" 2 " HorizontalAlignment =" Right " Margin =" 0 , 0 , 18 , 0 " Name =" Button 2 " Width =" 84 "> Button </ Button > < Label Margin =" 100 , 3 , 0 , 0 " Name =" Label 2 " HorizontalAlignment =" Left " Width =" 24 " Height =" 29 " Grid . RowSpan =" 2 " VerticalAlignment =" Top "> 단 </ Label > </ Grid > </ Grid ></ Window >