check for an instant of a dymanic form

B

Barkingmadscot

I am creating a dymanic form with dymanic controls i.e.

GenericFrom = New Form
btnAdd = New PureComponents.EntrySet.Controls.Button
btnClose = New PureComponents.EntrySet.Controls.Button

btnClose.Size = New Size(75, 23)
btnAdd.Size = New Size(75, 23)

DetailsForm.Opacity = 0.6
DetailsForm.Enabled = False

With GenericFrom
.Size = New Size((btnClose.Width + btnClose.Width) *
fGetDPI(), 245)
.StartPosition = FormStartPosition.Manual
.Opacity = 0.9
.ShowInTaskbar = False
.FormBorderStyle = FormBorderStyle.None
.TopMost = True
End With

With btnAdd
.Location = New Point((GenericFrom.Width - btnAdd.Width) *
fGetDPI(), GenericFrom.Height - btnAdd.Height)
.Text = "Add"
AddHandler btnAdd.Click, AddressOf btnAddBlock_Dest_click
End With

With btnClose
.Location = New Point(GenericFrom.Width - (btnClose.Width
+ btnClose.Width), GenericFrom.Height - btnClose.Height)
.Text = "Close"
AddHandler btnClose.Click, AddressOf btnClose_click
End With

........................................ with more code for the
handlers etc


The user is able to re-launch the same bit of code to do a different
task, this cause me problems the first control stop working correctly,
i.e the button stop work, i guess this is becuase the code is looking
at the second instant, which is closed.

What is i am looking for a way to see if the GenericFrom is visible

i have tried

console.writeline(GenericFrom.visible)

to see if a value is return, but a get a error, basically need a
instants of it before i can use it

any help would be great ta

Barry
 
L

Lloyd Sheen

Barkingmadscot said:
I am creating a dymanic form with dymanic controls i.e.

GenericFrom = New Form
btnAdd = New PureComponents.EntrySet.Controls.Button
btnClose = New PureComponents.EntrySet.Controls.Button

btnClose.Size = New Size(75, 23)
btnAdd.Size = New Size(75, 23)

DetailsForm.Opacity = 0.6
DetailsForm.Enabled = False

With GenericFrom
.Size = New Size((btnClose.Width + btnClose.Width) *
fGetDPI(), 245)
.StartPosition = FormStartPosition.Manual
.Opacity = 0.9
.ShowInTaskbar = False
.FormBorderStyle = FormBorderStyle.None
.TopMost = True
End With

With btnAdd
.Location = New Point((GenericFrom.Width - btnAdd.Width) *
fGetDPI(), GenericFrom.Height - btnAdd.Height)
.Text = "Add"
AddHandler btnAdd.Click, AddressOf btnAddBlock_Dest_click
End With

With btnClose
.Location = New Point(GenericFrom.Width - (btnClose.Width
+ btnClose.Width), GenericFrom.Height - btnClose.Height)
.Text = "Close"
AddHandler btnClose.Click, AddressOf btnClose_click
End With

....................................... with more code for the
handlers etc


The user is able to re-launch the same bit of code to do a different
task, this cause me problems the first control stop working correctly,
i.e the button stop work, i guess this is becuase the code is looking
at the second instant, which is closed.

What is i am looking for a way to see if the GenericFrom is visible

i have tried

console.writeline(GenericFrom.visible)

to see if a value is return, but a get a error, basically need a
instants of it before i can use it

any help would be great ta

Barry

Where is the variable GenericFrom defined? Do you have option strict and
explicit on. If not turn them on. Then the compiler will most likely
indicate what your problem is.

LS
 
Top