|
-
Dec 29th, 2004, 10:18 PM
#1
Thread Starter
Hyperactive Member
Closing Window
Hi,
In on of my VB.NET form, it will display some customer information.
However, if the customer does not exist, I want to close the window itself.
I've tried to put Me.Close inside the form's Load, Activated, HandleCreated, but I always get an error!
What is the proper way to achieve this goal?
Thx a lot!
-
Dec 29th, 2004, 10:19 PM
#2
Addicted Member
Re: Closing Window
Me.Hide to hide it, or to unload it, I think you can use Unload Me, but I'm not sure if .NET has unload in it.
-
Dec 30th, 2004, 01:02 AM
#3
Thread Starter
Hyperactive Member
Re: Closing Window
Hi,
I think I won't hide it, but just unload (close) it.
However, my problem is not how to close, but where to close!
Thx~
-
Dec 30th, 2004, 01:20 AM
#4
Hyperactive Member
Re: Closing Window
 Originally Posted by stm
Hi,
In on of my VB.NET form, it will display some customer information.
However, if the customer does not exist, I want to close the window itself.
I've tried to put Me.Close inside the form's Load, Activated, HandleCreated, but I always get an error!
What is the proper way to achieve this goal?
Thx a lot!
where did you put your checking in your customer information?
-
Dec 30th, 2004, 06:49 AM
#5
Re: Closing Window
 Originally Posted by fret
where did you put your checking in your customer information?

Fret is correct only display the form if the customers exists.
"The dark side clouds everything. Impossible to see the future is."
-
Dec 30th, 2004, 07:09 AM
#6
Addicted Member
Re: Closing Window
Hi, this is one of possible solutions:
VB Code:
private customerExist as boolean
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' put your code for check if customer exist
customerExist = CS_Exist()
End Sub
' and when you call Customer form in application
Dim frm As New FormCustomer
if frm.customerExist then
frm.ShowDialog
else
MessageBox.Show("There is no customers !")
end if
frm.dispose()
regard j
-
Dec 30th, 2004, 08:43 AM
#7
Fanatic Member
Re: Closing Window
Originally posted by janis
frm.dispose()
I hope the answer to the stm's answer is this statement.
-
Dec 30th, 2004, 08:46 AM
#8
Member
Re: Closing Window
How about using Application.exit()
-
Dec 30th, 2004, 09:00 AM
#9
Fanatic Member
Re: Closing Window
The question is
Originally posted by stm
However, if the customer does not exist, I want to close the window itself.
He doesn't want to close the application, simply the form which contains the details of the customer.
-
Dec 30th, 2004, 09:27 PM
#10
Thread Starter
Hyperactive Member
Re: Closing Window
Hi Janis,
I got the idea, I will try, thx a lot!
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
|