VB6: Cannot set "visible" property of user control
The following code block doesn't produce any errors, but it doesn't produce the desired result either. This code is executed within a procedure. ctlITIPTotal is a control array of user defined controls. lngTotalRecNo is a counter as I cycle through the array, OldTotRecords is the number of controls that were already loaded before I start cycling through. cmdFilter is an ADODB command object.
When this block of code finishes, the ctl1.visible property is still set to false. Does anyone have any ideas?
Thanks in advance,
Eldin
lngTotalRecNo = lngTotalRecNo + 1
If lngTotalRecNo > OldTotRecords Then Load ctlITIPTotal(lngTotalRecNo)
Set ctl1 = ctlITIPTotal(lngTotalRecNo)
ctl1.Year = cmdFilter.Parameters(1).Value
ctl1.District = cmdFilter.Parameters(0).Value
ctl1.Fund = cmdFilter.Parameters(2).Value
ctl1.PE = 0
ctl1.PC = 0
ctl1.RW = 0
ctl1.UT = 0
ctl1.CE = 0
ctl1.CN = 0
ctl1.Available = 0
ctl1.Total = 0
'ctlITIPRecord display properties
ctl1.Visible = True ' <--This is the relevant line
ctl1.Top = lngNextY + intDivider / 2
ctl1.Left = lngNextX + intDivider / 2
[1369 byte] By [
Eldin] at [2007-11-11 8:27:23]

# 2 Re: VB6: Cannot set "visible" property of user control
Yes. When I step through the code watching as each line executes. With the exception of the line in question, you can watch as each line changes the appropriate property, but the marked line appears to execute without actually modifying the ctl1.visible property.
Eldin at 2007-11-11 17:26:35 >

# 5 Re: VB6: Cannot set "visible" property of user control
I load user control arrays every time, and I do not have any problem with that using basically the same code of yours.
Is that a 3d party component or something developed in house? Are you sure that the control does not overload the Visible property?
Marco
mstraf at 2007-11-11 17:29:29 >

# 6 Re: VB6: Cannot set "visible" property of user control
It's a custom built control which consists of a number of labels, and a context menu. The control was created in-house and none of it's methods or properties have been overloaded. The visible property of element 0 of the array is set to false, and the new elements are inheriting that value when created. Defaulting element 0 to visible is inpractical because depending on user selected options these controls may or may not be displayed at a given time.
Eldin at 2007-11-11 17:30:39 >

# 7 Re: VB6: Cannot set "visible" property of user control
In the debugger things are different than in the running project. For example, even if you set the Visible property to True, it is possible that the component (that is hidden at that time because you are using the Edit dialog of VB) thinks that it is in reality non visible. I saw problems like that, with many other properties. So maybe your problem is in some other place. Maybe the control is visible, but is not positioned correctly in the dialog so that is not visible, or is under another control etc. I will look into that direction
Marco
mstraf at 2007-11-11 17:31:32 >

# 8 Re: VB6: Cannot set "visible" property of user control
If lngTotalRecNo > OldTotRecords
It looks like
if the value in OldTotRecords is greater than or = to the value in lngTotalRecNo then you will not hit the set visible statement.
Try putting a value in OldTotRecords.
jp495 at 2007-11-11 17:32:31 >
