s2p3 Abr16 Investigacion1 Grupo1 Definicion de Prametros en Procedimientos

download s2p3 Abr16 Investigacion1 Grupo1 Definicion de Prametros en Procedimientos

of 2

Transcript of s2p3 Abr16 Investigacion1 Grupo1 Definicion de Prametros en Procedimientos

  • 8/16/2019 s2p3 Abr16 Investigacion1 Grupo1 Definicion de Prametros en Procedimientos

    1/2

    Option ExplicitDim tam As IntegerDim car As StringDim car2 As String

    Function validar() As IntegerIf (txt_tam "") Then

      If (IsNumeric(txt_tam) = True) Then  If (Val(txt_tam) > 0) Then  tam = Val(txt_tam)  If (txt_car "" And txt_car2 "") Then  car = txt_car  car2 = txt_car2  grid.Cols = tam  grid.Rows = tam  validar = 1  Else  MsgBox ("Ingrese un caracter")  txt_car.SetFocus

      txt_car2.SetFocus  validar = 0  End If  Else  MsgBox ("Tamanio debe ser mayor a 0")  txt_tam.Text = ""  txt_tam.SetFocus  validar = 0  End If  Else  MsgBox ("Tamanio debe ser numerico")  txt_tam.Text = ""  txt_tam.SetFocus

      validar = 0  End IfElse  MsgBox ("Ingrese Tamanio")  txt_tam.SetFocus  validar = 0End IfEnd Function

    Private Sub desplegar(i As Integer, j As Integer, diagonal As String, Optional restom As String)For i = 0 To tam - 1

      For j = 0 To tam - 1  If (i = j) Then  grid.TextMatrix(i, j) = car  Else  grid.TextMatrix(i, j) = car2 

    End If  Next jNext idiagonal = carlbl_diagonal = diagonalrestom = car2lbl_restom = restom

    End Sub

    Private Sub btn_desplegar_Click()

  • 8/16/2019 s2p3 Abr16 Investigacion1 Grupo1 Definicion de Prametros en Procedimientos

    2/2

    If (validar = 1) Then  Call desplegar("1", "1", "f")  btn_desplegar.Enabled = False  btn_limpiar.Enabled = TrueEnd IfEnd Sub

    Private Sub btn_limpiar_Click()txt_tam.Text = ""txt_car.Text = ""txt_car2.Text = ""grid.Clearlbl_restom.Caption = ""lbl_diagonal.Caption = ""btn_limpiar.Enabled = Falsebtn_desplegar.Enabled = TrueEnd Sub