Randem Systems Support Board

Visual Basic - Problems and Solutions => Visual Basic 6 => Topic started by: beryls on December 31, 2008, 10:59:56 PM

Title: wrong number of arguments or invalid property assignment
Post by: beryls on December 31, 2008, 10:59:56 PM
hi everyone. i am a newbie in vb 6. i have tried the coding above but i get  wrong number of arguments or invalid property assignment in Load Label1(i). can anybody help me? thanks in advanced
 
 
 
Moved....
Title: wrong number of arguments or invalid property assignment
Post by: Randem on January 01, 2009, 04:14:23 PM
Welcome beryls,
 
You should not hijack someone else's thread. Please start your own next time.
 
Without seeing your code it would be complete guesses.  
 
Ex.
 
 
How is i defined?
Have you defined your object as an array
etc...
Title: wrong number of arguments or invalid property assignment
Post by: beryls on January 02, 2009, 03:23:48 PM
oops sorry randem.i am a newbie here as well. sorry for any inconvenience..
 
this is my coding on creating the label array in form_load().
 
 
Dim i As Integer
Dim lbl() As Label
 
rs1.Open Select * From Items, cn, 3, 2
 
For i = 1 To rs1.RecordCount
Load lbl1(i)
Me(lbl1).Caption = rs1!ItemID
rs1.MoveNext
Next
 
p/s:lbl1 is the name of label created in GUI.
in the coding above, error wrong number of arguments or invalid property assignment.. but if i put Load lbl1() as comment, it displays only the last row of data in database.
 
can anybody help me on this??
thanks in advanced.
 
(Message edited by beryls on January 02, 2009)
Title: wrong number of arguments or invalid property assignment
Post by: beryls on January 02, 2009, 05:18:53 PM
hi there.i have already got the solution for it.here i want to share with it.
this is how to creta dynamic label array in vb6.

 
       For i = 1 To rs1.RecordCount
 
           Set lbl = Me.Controls.Add(vb.Label, lbl & i)
            Me(lbl & i).Height = 255
            Me(lbl & i).Width = 6375
            Me(lbl & i).Left = 360
            Me(lbl & i).Top = 1920   (i * 200)
            Me(lbl & i).Visible = True
            Me(lbl & i).BackStyle = 0
            Me(lbl & i).Font = Comic Sans MS, regular, 8
            Me(lbl & i).Caption = rs1!ItemID
           rs1.MoveNext
       Next

 
thanks anyway randem..
Title: wrong number of arguments or invalid property assignment
Post by: Randem on January 02, 2009, 08:06:05 PM
Here is an example project that does that as well. Look here for a project on Dynamic Frames - https://randemsystems.com/freeware.html (https://randemsystems.com/freeware.html)
Title: wrong number of arguments or invalid property assignment
Post by: beryls on January 02, 2009, 09:13:22 PM
oh thanks randem..i did it! as the data listed in the form is larger than the form height, so i would like to create a vertical scrollbar as the coding below. however, it can't work. can anybody help me on it?
thanks..
 
Sub ChangeScrollBars()
    VScroll1.Height = Me.ScaleHeight
    VScroll1.Top = 0: VScroll1.Left = Me.ScaleWidth - VScroll1.Width
     
    Label1.Top = (-1 * VScroll1)
    Label2.Top = (-1 * VScroll1)
    Label3.Top = (-1 * VScroll1)
    Label4.Top = (-1 * VScroll1)
    Label5.Top = (-1 * VScroll1)
    Label6.Top = (-1 * VScroll1)
    Label7.Top = (-1 * VScroll1)
    Label8.Top = (-1 * VScroll1)
    Label9.Top = (-1 * VScroll1)
    Label10.Top = (-1 * VScroll1)
    Label11.Top = (-1 * VScroll1)
    Label12.Top = (-1 * VScroll1)
    Label13.Top = (-1 * VScroll1)
    txtPO.Top = (-1 * VScroll1)
    cboSupplier.Top = (-1 * VScroll1)
    Date.Top = (-1 * VScroll1)
    cmdMain.Top = (-1 * VScroll1)
    cmdLogout.Top = (-1 * VScroll1)
     
End Sub
 
Private Sub Form_Resize()
    ChangeScrollBars
End Sub
 
Private Sub VScroll1_Change()
    ChangeScrollBars
End Sub
Title: wrong number of arguments or invalid property assignment
Post by: Randem on January 03, 2009, 03:59:48 PM
If you are using MDI forms it would be quite easy, however using standard forms I don't think you can achieve this without subclassing.
Title: wrong number of arguments or invalid property assignment
Post by: beryls on January 03, 2009, 05:12:46 PM
okay thanks.i get what you mean.i will try on it. ;p