Visual Basic - Necesito Ayuda VB6.0 ( II )

Life is soft - evento anual de software empresarial
 
Vista:

Necesito Ayuda VB6.0 ( II )

Publicado por Noe (9 intervenciones) el 31/12/2003 21:42:30
Option Explicit
Dim x As Integer

Private Sub Ficha_KeyPress(KeyAscii As Integer)
Call Movimiento(KeyAscii)
End Sub

Function Movimiento(KeyAscii As Integer)
If KeyAscii = 50 Then
If Ficha.Top < 3360 Then
Ficha.Top = Ficha.Top + 360
Else
KeyAscii = 0
End If
End If
If KeyAscii = 56 Then
If Ficha.Top > 120 Then
Ficha.Top = Ficha.Top - 360
Else
KeyAscii = 0
End If
End If
If KeyAscii = 52 Then
If Ficha.Left > 120 Then
Ficha.Left = Ficha.Left - 360
Else
KeyAscii = 0
End If
End If
If KeyAscii = 54 Then
If Ficha.Left < 3000 Then
Ficha.Left = Ficha.Left + 360
Else
KeyAscii = 0
End If
End If
End Function

Private Sub Ficha2_KeyPress(KeyAscii As Integer)
Call Movimiento2(KeyAscii)
End Sub

Function Movimiento2(KeyAscii As Integer)
If KeyAscii = 50 Then
If Ficha2.Top < 3360 Then
Ficha2.Top = Ficha2.Top + 360
Else
KeyAscii = 0
End If
End If
If KeyAscii = 56 Then
If Ficha2.Top > 120 Then
Ficha2.Top = Ficha2.Top - 360
Else
KeyAscii = 0
End If
End If
If KeyAscii = 52 Then
If Ficha2.Left > 120 Then
Ficha2.Left = Ficha2.Left - 360
Else
KeyAscii = 0
End If
End If
If KeyAscii = 54 Then
If Ficha2.Left < 3000 Then
Ficha2.Left = Ficha2.Left + 360
Else
KeyAscii = 0
End If
End If
End Function
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Necesito Ayuda VB6.0 ( II )

Publicado por Fernando (166 intervenciones) el 01/01/2004 23:15:23
Vamos por partes, si vos tenes una matris de controles y sobre unos de ellos le agregas un procedimiento de evento keypress, te va a quedar asi: Control_KeyPress(Index as Integer, KeyAscii as Integer). Como veras tenes un parametro que te pasa la misma función llamado index, este sirve para que identifiques sobre que control se dio el evento. Es decir que si queres cambiar una propiedad del control sobre el que se presiono una tecla, haces esto:

Private Sub Control_KeyPress(Index as Integer, KeyAscii as Integer)
Control(Index).Propiedad = Valor
End Sub

Fijate que se escribe el nombre del control, y seguido entre parentesis la variable Index, que contiene el valor del control que se hizo click. A partir de esto, creo que te daras cuenta de como hacer lo que queres.

Suerte, y feliz año!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

MUchisimas gracias

Publicado por Noe (9 intervenciones) el 05/01/2004 16:29:35
Gracias fer por tu tiempo te lo agradesco mucho..:D
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar