|
-
Nov 23rd, 2012, 02:44 AM
#1
Thread Starter
Member
how to disable multiple opening of forms
how can i disable multiple opening of forms.i have a mdi parent form,on other form i am using child.showdialog and it works perfectly.The problem comes when i have a form that has a button that opens another form..how do i restrict a user not to open other forms until this form is closed because when i use show.dialog on the other form that opens a new one the former remains in the background while i want it to close
-
Nov 23rd, 2012, 10:19 AM
#2
Addicted Member
Re: how to disable multiple opening of forms
Not sure how many forms you are using, but if it is not to many, I would just use an If then statement
If Form2.visible = False or Form3.visible = False then
' Show whatever form needs to be shown
Else
exit sub ' do nothing
End If
Exit Sub exits the process, so nothing happens
Another way you might go is accessing the forms collection, but I would only do that if
you have a large number of forms.
.
We must question the story logic of having an all-knowing all-powerful God, who creates faulty Humans, and then blames them for his own mistakes.
GENE RODDENBERRY
.
http://www.tachufind.com
.
-
Nov 26th, 2012, 02:10 AM
#3
Thread Starter
Member
Re: how to disable multiple opening of forms
thanks for the response. i have incorporated your idea and i have
if me.visible = true then
frmmainmenu.enabled=false
elseif me.visible=false then
frmmainmenu.enabled=true
end if
but the main menu is remaining disabled once i open the me form(being the form new customer) and if i close the form that has the button to open the me form it still remains disabled
-
Nov 26th, 2012, 12:49 PM
#4
Re: how to disable multiple opening of forms
Where is this code exactly? In any case if me.Visible = false never applies because if me.Visible = false then me.running code = false too!
vb.net Code:
' On Form2 which is your "Me" Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Form3.Show ' this is the form you only want one of Me.Close() End Sub ' On Form3 Private Sub Form3_FormClosed(sender As System.Object, e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed Form2.Show() End Sub
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 27th, 2012, 01:19 AM
#5
Thread Starter
Member
Re: how to disable multiple opening of forms
i put the code on the main form ie the mdi. the me is referring to the form i am opening ie frmnewcustomer
if frmnewcustomer.visible= true then
radmenu.enabled = false
else if frmnewcustomer.visible=false then
radmenu.enabled = true
exit sub
end if
-
Nov 27th, 2012, 11:26 AM
#6
Re: how to disable multiple opening of forms
I don't care which form it's on, what event is it using? Can you really not see the difference in detail between my code samples and yours? Did you even try the suggestion I made?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Tags for this Thread
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
|