No, il codice mi da un errore, penso sia dovuto al fatto k ogni Image è un array, mentre la variabile img non rappresenta un array ma punta solo a uno di essi. Sapete aiutarmi?Originariamente inviato da MItaly
Non ho sottomano VB6, ma qualcosa del genere dovrebbe funzionare:
codice:Public Function crea(Tipo, Vtag As String, VHeight, Vleft, Vtop, VWidth As Integer) Dim i As Integer Dim img As ImageBox Select Case Tipo Case "uno" Set img=Image1 Case "due" Set img=Image2 '... End Select If Not (img Is Nothing) Then With img i = .UBound + 1 Load .Item(i) .Item(i).Visible = True .Item(i).Top = Vtop .Item(i).Width = VWidth .Item(i).Left = Vleft .Item(i).Height = VHeight .Item(i).Tag = Vtag End With End If End Function
Ho provato a fare una dichiatazione di Img com array
Dim Img() as Image
Ma poi mi da un errore nell'assegnazione "Can't assign to array", ovvero qui:
Set img=Image1