Code Comments
Programming Forum and web based access to our favorite programming groups.Hi. Here's my programme to automatically create new controls during runtime
in VB 6.0 SP6. However, when I clicked "finish" button or FinishCmd_Click or
tries to terminate the programme using normal VB stop, VB 6.0 crashed (erro
r and exit). Please advise.
Private Sub AddGfrCmd_Click()
Dim mytime
Dim mydate As Date
Dim n, tc, tcc As Double
Dim txt As TextBox
Dim frm As Frame
Dim new_index As Integer
Dim i As Integer
'Dim max_top As Single
If CounterTB(0).Text = "" Then
n = 1
GFRFr(0).Caption = "Functional Requirement" & Space(1) & "1"
CounterTB(0).Text = "1"
mytime = Time
TimeTB(0).Text = mytime
mydate = Date
DateTB(0).Text = mydate
SOLIDTB(0) = "S" & "1"
GFRTB(0).SetFocus
CategoryCb(0).Locked = False
GFRTB(0).Locked = False
Else:
new_index = CounterTB.UBound + 1
Load GFRFr(new_index)
Load CounterTB(new_index)
Load nolbl(new_index)
Load tdlbl(new_index)
Load TimeTB(new_index)
Load DateTB(new_index)
Load ctlbl(new_index)
Load CategoryCb(new_index)
Load GFRlbl(new_index)
Load GFRTB(new_index)
Load IfrIDlbl(new_index)
Load IFRIDlst(new_index)
Load SolIDlbl(new_index)
Load SOLIDTB(new_index)
' Put the new controls inside the right frame.
Set GFRFr(new_index).Container = gfrfrm
Set CounterTB(new_index).Container = GFRFr(new_index)
Set nolbl(new_index).Container = GFRFr(new_index)
Set tdlbl(new_index).Container = GFRFr(new_index)
Set TimeTB(new_index).Container = GFRFr(new_index)
Set DateTB(new_index).Container = GFRFr(new_index)
Set ctlbl(new_index).Container = GFRFr(new_index)
Set CategoryCb(new_index).Container = GFRFr(new_index)
Set GFRlbl(new_index).Container = GFRFr(new_index)
Set GFRTB(new_index).Container = GFRFr(new_index)
Set IfrIDlbl(new_index).Container = GFRFr(new_index)
Set IFRIDlst(new_index).Container = GFRFr(new_index)
Set SolIDlbl(new_index).Container = GFRFr(new_index)
Set SOLIDTB(new_index).Container = GFRFr(new_index)
GFRTB(new_index).Locked = False
' Find the largest Top value in this frame.
For i = 0 To new_index - 1
If GFRFr(i).Container Is gfrfrm Then
If max_top < GFRFr(i).Top Then max_top = GFRFr(i).Top
End If
Next i
' Position the new control.
GFRFr(new_index).Top = max_top + GFRFr(new_index).Height
'CounterTB(new_index).Top = 720
' Make the control visible.
GFRFr(new_index).Visible = True
CounterTB(new_index).Visible = True
nolbl(new_index).Visible = True
tdlbl(new_index).Visible = True
TimeTB(new_index).Visible = True
DateTB(new_index).Visible = True
ctlbl(new_index).Visible = True
CategoryCb(new_index).Visible = True
GFRlbl(new_index).Visible = True
GFRTB(new_index).Visible = True
IfrIDlbl(new_index).Visible = True
IFRIDlst(new_index).Visible = True
SolIDlbl(new_index).Visible = True
SOLIDTB(new_index).Visible = True
'Display control
GFRFr(new_index).Caption = "Functional Requirement" & Space(1) & new_ind
ex + 1
CounterTB(new_index).Text = new_index + 1
TimeTB(new_index).Text = Time
DateTB(new_index).Text = Date
SOLIDTB(new_index).Text = "S" & new_index + 1
CategoryCb(new_index).AddItem "Requirement"
CategoryCb(new_index).AddItem "Constraint"
CategoryCb(new_index).AddItem "Criteria"
GFRTB(new_index).Text = ""
End If
End Sub
Private Sub AddifrCmd_Click()
Dim msg, style, title, response
If CounterTB(0).Text = "" Then
msg = "Please fill in the Given Functional Requirement before adding Introdu
ced Functional Requirement"
style = vbOKOnly
title = "Error!"
response = MsgBox(msg, style, title)
Else:
ifrfrm.Show
End If
End Sub
Private Sub FinishCmd_Click()
End
End Sub
Private Sub Form_Load()
CategoryCb(new_index).Locked = True
GFRTB(new_index).Locked = True
End Sub
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.