[Message Deleted]
-
Does ctl exist at this point ? Does it need to be initialised ? Christian Graus - Microsoft MVP - C++
-
Garrett Klas wrote:
Private sub Example() Dim ctl as ctlExample Dim iFontSize as integer iFontSize = ctl.Fontsize <-- Throws Object/Variable not set Error End Sub
ctl is not initialised. All you have done is reference it. You need Dim ctl as new ctlExample, or a Set ctl = new ctlExample at the start of the routine. Having said that, the control, assuming it is a User Control, should be sited on a form. Just accessing the control in the manner you show probably won't do anything as it would be creating a new instance of the control and I am not sure where it would be. You really need to access the control where it is sited i.e. 'Form1.ctlExample.FontSize = x' again assuming that you have a property called FontSise exposed in the control. -- modified at 6:19 Thursday 10th November, 2005
-
Garrett Klas wrote:
Private sub Example() Dim ctl as ctlExample Dim iFontSize as integer iFontSize = ctl.Fontsize <-- Throws Object/Variable not set Error End Sub
ctl is not initialised. All you have done is reference it. You need Dim ctl as new ctlExample, or a Set ctl = new ctlExample at the start of the routine. Having said that, the control, assuming it is a User Control, should be sited on a form. Just accessing the control in the manner you show probably won't do anything as it would be creating a new instance of the control and I am not sure where it would be. You really need to access the control where it is sited i.e. 'Form1.ctlExample.FontSize = x' again assuming that you have a property called FontSise exposed in the control. -- modified at 6:19 Thursday 10th November, 2005
-
OK, I hope I am understanding you correctly. Al you need to do is to set the variable in the class to the font size. You do not need to reference the control at all. [In Class Pane] Public FontSize As Integer etc [In User Control] strIndex = Panes.Add(??? variables if you have them) Panes(strIndex).FontSize = UserControl.FontSize I don't have VB6 with me but if this doesa not help can ive you a fuller example tomorrow. -- modified at 3:09 Friday 11th November, 2005