为什么会出现堆栈空间溢出
Option ExplicitPrivate mstrRoomName As String
Private mstrRoomNo As String
Private mintRoomRenShu As Integer
Private intRoomMoney As Single
Private rtLeastCost As Single
Private mstrRoomBackColor As String
Private mblnIsSelect As Boolean
'Private mstrLabStatus As String
Public Event Click()
Public Event DBlClick()
'属性:是否选中
Public Property Let IsSelect(ByVal New_Value As Boolean)
mblnIsSelect = New_Value
ShaSelect.Visible = New_Value
End Property
Public Property Get IsSelect() As Boolean
IsSelect = mblnIsSelect
End Property
'属性:餐台编码
Public Property Get RoomNo() As String
RoomNo = mstrRoomNo
End Property
Public Property Let RoomNo(ByVal New_Value As String)
mstrRoomNo = New_Value
LabCanTaiNo.Caption = mstrRoomNo
End Property
'属性:餐台名称
Public Property Get RoomName() As String
RoomName = mstrRoomName
End Property
Public Property Let RoomName(ByVal New_Value As String)
mstrRoomName = New_Value
LabCanTaiName.Caption = mstrRoomName
End Property
'属性:餐台状态值
Public Property Get RoomBackColor() As String
RoomBackColor = mstrRoomBackColor
End Property
Public Property Let RoomBackColor(ByVal New_Value As String)
mstrRoomBackColor = New_Value
Select Case New_Value
Case "空闲"
LabCanTaiStatus.Caption = "空闲"
Picture2.BackColor = strKeYongTaiBackColor
Case "占用"
LabCanTaiStatus.Caption = "占用"
Picture2.BackColor = strZhanYongTaiBackColor
Case "停用"
LabCanTaiStatus.Caption = "停用"
Picture2.BackColor = strTingYongTaiBackColor
Case "预定"
LabCanTaiStatus.Caption = "预定"
Picture2.BackColor = strYiDingTaiBackColor
Case "脏台"
LabCanTaiStatus.Caption = "脏台"
Picture2.BackColor = strDaSaoTaiBackColor
End Select
End Property
'属性:餐台就餐人数
Public Property Get RoomRenShu() As Integer
RoomBackColor = mstrRoomBackColor
End Property
Public Property Let RoomRenShu(ByVal New_Value As Integer)
mintRoomRenShu = New_Value
LabRenShu.Caption = "人数:" & Str(mintRoomRenShu)
LabRenShu.Visible = True
End Property
'属性:餐台就餐消费总金额
Public Property Get RoomMoney() As Single
RoomMoney = intRoomMoney
End Property
Public Property Let RoomMoney(ByVal New_Value As Single)
RoomMoney = New_Value
LabMoney.Caption = "总额¥:" & Trim(RoomMoney)
LabMoney.Visible = True
End Property
'属性:餐台最低消费金额
Public Property Get LeastCost() As Single
LeastCost = rtLeastCost
End Property
Public Property Let LeastCost(ByVal New_Value As Single)
LeastCost = New_Value
LabMoney.Tag = LeastCost
'LabMoney.Visible = True
End Property
Private Sub LabCanTaiName_DblClick()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent DBlClick
End Sub
Private Sub LabMoney_DBlClick()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent DBlClick
End Sub
Private Sub LabRenShu_DBlClick()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent DBlClick
End Sub
Private Sub Picture1_dblClick()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent DBlClick
End Sub
Private Sub Picture2_DBlClick()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent DBlClick
End Sub
Private Sub LabCanTaiName_Click()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent Click
End Sub
Private Sub LabMoney_Click()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent Click
End Sub
Private Sub LabRenShu_Click()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent Click
End Sub
Private Sub Picture1_Click()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent Click
End Sub
Private Sub Picture2_Click()
strRoomNo = LabCanTaiNo.Caption
strRoomName = LabCanTaiName.Caption
RaiseEvent Click
End Sub
Private Sub UserControl_Click()
RaiseEvent Click
End Sub
Private Sub UserControl_DblClick()
RaiseEvent DBlClick
End Sub
Private Sub UserControl_Initialize()
Picture1.Left = 60
Picture1.Top = 40
Picture1.Width = UserControl.Width - 100
Picture1.Height = UserControl.Height / 5
Picture2.Left = Picture1.Left
Picture2.Top = Picture1.Top + Picture1.Height
Picture2.Height = UserControl.Height * 4 / 5 - 140
ShaSelect.Move 20, 0, UserControl.Width - 20, UserControl.Height - 80
LabCanTaiStatus.Left = (Picture1.Width - LabCanTaiStatus.Width) / 2
LabCanTaiName.Top = Picture2.Height / 4
LabCanTaiName.Left = (Picture2.Width - LabCanTaiName.Width) / 2
End Sub
当我对以下属性进行赋值的时候会现堆栈空间溢出,请问高手这要如何解决啊?
'属性:餐台就餐人数
Public Property Get RoomRenShu() As Integer
RoomBackColor = mstrRoomBackColor
End Property
Public Property Let RoomRenShu(ByVal New_Value As Integer)
mintRoomRenShu = New_Value
LabRenShu.Caption = "人数:" & Str(mintRoomRenShu)
LabRenShu.Visible = True
End Property
'属性:餐台就餐消费总金额
Public Property Get RoomMoney() As Single
RoomMoney = intRoomMoney
End Property
Public Property Let RoomMoney(ByVal New_Value As Single)
RoomMoney = New_Value
LabMoney.Caption = "总额¥:" & Trim(RoomMoney)
LabMoney.Visible = True
End Property
'属性:餐台最低消费金额
Public Property Get LeastCost() As Single
LeastCost = rtLeastCost
End Property
Public Property Let LeastCost(ByVal New_Value As Single)
LeastCost = New_Value
LabMoney.Tag = LeastCost
'LabMoney.Visible = True
End Property 用户控件 Vb 堆栈空间溢出 --------------------编程问答-------------------- --------------------编程问答-------------------- 肯定是改变某属性--->产生某事件--->某事件里又改变了这个属性---->如此循环,堆栈溢出....
这个问题很好跟踪啊,调试一下就可以找到原因了 --------------------编程问答-------------------- 情况应该跟老马说的一样,我只试过在Resize事件溢出过,就是因为在Resize里改变了Width或者Height,变成了死循环……
补充:VB , 数据库(包含打印,安装,报表)