|
-
Oct 7th, 2012, 12:22 PM
#1
Thread Starter
PowerPoster
[VB6] - error message without ID only message
what means "out of stack space"?
when i do:
Code:
If lngRotate <> 0 Then
UserControl.Width = GRP.Width * Screen.TwipsPerPixelX
UserControl.Height = GRP.Height * Screen.TwipsPerPixelY
End If
-
Oct 7th, 2012, 09:41 PM
#2
Re: [VB6] - error message without ID only message
Read MSDN description of this error.
I guess this code is in a recursive procedure.
Last edited by 4x2y; Oct 7th, 2012 at 10:01 PM.
-
Oct 8th, 2012, 07:54 AM
#3
Thread Starter
PowerPoster
Re: [VB6] - error message without ID only message

ok. i have the resize event on usercontrol. but why i get the error only in that lines and not before(yes before that lines i resize the control. but when i use the rotate effect, i must resize the control)?
-
Oct 8th, 2012, 08:02 AM
#4
Re: [VB6] - error message without ID only message
wait... you have that code in the resize event? which will also cause a resize event to be triggered... running that code... which triggers the resize event, which runs that code, which triggers the resize event, which fires off that code... you see where this is going?
-tg
-
Oct 8th, 2012, 08:06 AM
#5
Thread Starter
PowerPoster
Re: [VB6] - error message without ID only message
i have 1 code for show the image and resize the control(usercontrol). but if we resize the control the control(itself) activate the resize event
Code:
Private Sub UserControl_Resize()
On Error Resume Next
If UserControl.hWnd = 0 Then Exit Sub
If blnShowed = True Then Call ShowImage
If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
ResizeTyp = ResizeVerticalHorizontal
ElseIf UserControl.Width <> lngOldWidth Then
ResizeTyp = ResizeHorizontal
ElseIf UserControl.Height <> lngOldHeight Then
ResizeTyp = ResizeVertical
End If
lngOldWidth = UserControl.Width
lngOldHeight = UserControl.Height
RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
End Sub
-
Oct 8th, 2012, 08:08 AM
#6
Re: [VB6] - error message without ID only message
When you resize the control inside its Resize event, it is fire infinity, to control this, add a flag to exit the Resize event when perform resize inside it, Ex
Code:
Private Sub Form_Resize()
Static blnResizing As Boolean
If blnResizing Then Exit Sub' comment this line and see the difference :-)
blnResizing = True
Me.Width = Me.Width + Screen.TwipsPerPixelX * 8
blnResizing = False
End Sub
-
Oct 8th, 2012, 08:15 AM
#7
Thread Starter
PowerPoster
Re: [VB6] - error message without ID only message
 Originally Posted by 4x2y
When you resize the control inside its Resize event, it is fire infinity, to control this, add a flag to exit the Resize event when perform resize inside it, Ex
Code:
Private Sub Form_Resize()
Static blnResizing As Boolean
If blnResizing Then Exit Sub' comment this line and see the difference :-)
blnResizing = True
Me.Width = Me.Width + Screen.TwipsPerPixelX * 8
blnResizing = False
End Sub
you have right. it's a infinite cycle. and i don't know how avoid that
-
Oct 8th, 2012, 08:23 AM
#8
Re: [VB6] - error message without ID only message
i don't know how avoid that
Like i did 
Code:
Private Sub UserControl_Resize()
Static blnResizing As Boolean ' ----------------- New Code
On Error Resume Next
If blnResizing Then Exit Sub ' ----------------- New Code
If UserControl.hWnd = 0 Then Exit Sub
If blnShowed = True Then Call ShowImage
If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
ResizeTyp = ResizeVerticalHorizontal
ElseIf UserControl.Width <> lngOldWidth Then
ResizeTyp = ResizeHorizontal
ElseIf UserControl.Height <> lngOldHeight Then
ResizeTyp = ResizeVertical
End If
lngOldWidth = UserControl.Width
lngOldHeight = UserControl.Height
blnResizing = True ' ----------------- New Code
RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
blnResizing = False ' ----------------- New Code
End Sub
I don't know if this will be compatible with your code or not, just give it a try.
Last edited by 4x2y; Oct 8th, 2012 at 08:26 AM.
-
Oct 8th, 2012, 08:37 AM
#9
Thread Starter
PowerPoster
Re: [VB6] - error message without ID only message
 Originally Posted by 4x2y
Like i did
Code:
Private Sub UserControl_Resize()
Static blnResizing As Boolean ' ----------------- New Code
On Error Resume Next
If blnResizing Then Exit Sub ' ----------------- New Code
If UserControl.hWnd = 0 Then Exit Sub
If blnShowed = True Then Call ShowImage
If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
ResizeTyp = ResizeVerticalHorizontal
ElseIf UserControl.Width <> lngOldWidth Then
ResizeTyp = ResizeHorizontal
ElseIf UserControl.Height <> lngOldHeight Then
ResizeTyp = ResizeVertical
End If
lngOldWidth = UserControl.Width
lngOldHeight = UserControl.Height
blnResizing = True ' ----------------- New Code
RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
blnResizing = False ' ----------------- New Code
End Sub
I don't know if this will be compatible with your code or not, just give it a try.
and i did and works:
Code:
Private Sub UserControl_Resize()
Static blnResizing As Boolean
If blnResizing Then Exit Sub ' comment this line and see the difference :-)
blnResizing = True
On Error Resume Next
If UserControl.hWnd = 0 Then Exit Sub
If blnShowed = True Then Call ShowImage
If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
ResizeTyp = ResizeVerticalHorizontal
ElseIf UserControl.Width <> lngOldWidth Then
ResizeTyp = ResizeHorizontal
ElseIf UserControl.Height <> lngOldHeight Then
ResizeTyp = ResizeVertical
End If
lngOldWidth = UserControl.Width
lngOldHeight = UserControl.Height
RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
blnResizing = False
End Sub
i have a new question that i think you can advice me
i want do the same to showimage() sub. but like you know, we, always, change the graphics effects properties. then how i can do that boolean way? in same way?
thanks
-
Oct 9th, 2012, 04:11 AM
#10
Re: [VB6] - error message without ID only message
i want do the same to showimage() sub. but like you know, we, always, change the graphics effects properties. then how i can do that boolean way? in same way?
I cannot give you a sample code because i don't know which properties are affected by ShowImage sub, but in general if i have one ore more property i don't want to execute it when changing its value (by code), i declare a module level boolean variable, set it to true before changing the property value and false after it, and in the property or the event it is fire i check the module level boolean variable. Here is a sample i frequently use with TextBox, i hope it help you.
Code:
Private mblnChangedByCode As Boolean
Private Sub Test()
mblnChangedByCode = True
Text1.Text = "Value"
mblnChangedByCode = False
End Sub
Private Sub Text1_Change()
If mblnChangedByCode = True Then Exit Sub
' Here is some code i want to execute it ONLY if the user changed the text by typing something,
' but never execute when i change the text via the Text property.
End Sub
-
Oct 9th, 2012, 04:14 AM
#11
Thread Starter
PowerPoster
Re: [VB6] - error message without ID only message
 Originally Posted by 4x2y
I cannot give you a sample code because i don't know which properties are affected by ShowImage sub, but in general if i have one ore more property i don't want to execute it when changing its value (by code), i declare a module level boolean variable, set it to true before changing the property value and false after it, and in the property or the event it is fire i check the module level boolean variable. Here is a sample i frequently use with TextBox, i hope it help you.
Code:
Private mblnChangedByCode As Boolean
Private Sub Test()
mblnChangedByCode = True
Text1.Text = "Value"
mblnChangedByCode = False
End Sub
Private Sub Text1_Change()
If mblnChangedByCode = True Then Exit Sub
' Here is some code i want to execute it ONLY if the user changed the text by typing something,
' but never execute when i change the text via the Text property.
End Sub
thanks for all
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|