

Fitxer: m3p1.frm
Definició dels objectes. Interfície d'usuari
Recordeu que això no ho podeu editar directament. Per fer-ho incorporeu nous objectes
de la paleta en el vostre formulari. I per canviar els valors seleccioneu l'objecte i
escolliu la propietat a canviar en la finestra Properties.
VERSION 5.00
Begin VB.Form Form1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Vector"
ClientHeight = 2415
ClientLeft = 1650
ClientTop = 2235
ClientWidth = 3930
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 2415
ScaleWidth = 3930
Begin VB.TextBox txtDada
Appearance = 0 'Flat
Height = 285
Left = 2160
TabIndex = 4
Top = 1560
Width = 735
End
Begin VB.TextBox txtLloc
Appearance = 0 'Flat
Height = 285
Left = 2160
TabIndex = 3
Top = 960
Width = 735
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Té com a dada:"
ForeColor = &H80000008&
Height = 255
Left = 480
TabIndex = 2
Top = 1560
Width = 1455
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Element número:"
ForeColor = &H80000008&
Height = 255
Left = 480
TabIndex = 1
Top = 960
Width = 1575
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Aquest programa té un vector de sis elements"
ForeColor = &H80000008&
Height = 495
Left = 480
TabIndex = 0
Top = 120
Width = 2895
End
End
Codi del programa. Programació de respostes a events
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim vectorProva(6) As Integer
Private Sub Form_Load()
vectorProva(1) = 10
vectorProva(2) = 20
vectorProva(3) = 30
vectorProva(4) = 40
vectorProva(5) = 50
vectorProva(6) = 60
End Sub
Private Sub txtLloc_Change()
Dim i As Integer
i = Val(txtLloc)
If i > 0 And i < 7 Then
txtDada = Str(vectorProva(i))
End If
End Sub