Click to See Complete Forum and Search --> : Me.Hide & Me.Close
ISMSH
March 29th, 2004, 04:30 PM
hello guys :) how are you all
well i want to know what the exactly different between :
Me.Hide & Me.Close ?
also when i use me.hide its hide the form but it keeps the same rusult on it so when i show it its don't restart again and to be empty result !!!
is there is any better code to use in this setuation ?
thanks for help :)
Craig Gemmill
March 29th, 2004, 06:16 PM
I know you come from a VB6 background, so I'll compare the two:
Me.Hide acts just like it did in VB6, it just hides the form from the users view, but does not destroy it's resources.
Me.Close acts very much like Unload Me in VB6.
If you want a clean slate each time:
Dim fMyForm as Form1
For x as integer = 0 to 10
'
'Create new instance of Form1, to clear any previous information
'
fMyForm = new Form1
'
'Show the form modal (vbmodal)
'
fMyForm.ShowDialog 'Will not return until you me.close, hit esc, alt+f4, [x], etc...
Next
vnInformatics
March 29th, 2004, 09:14 PM
Originally posted by ISMSH
hello guys :) how are you all
well i want to know what the exactly different between :
Me.Hide & Me.Close ?
also when i use me.hide its hide the form but it keeps the same rusult on it so when i show it its don't restart again and to be empty result !!!
is there is any better code to use in this setuation ?
thanks for help :)
I donot have any idea different from Craig Gemmill. But just want to addition something: You'd better use MSDN, it is very useful to help you program well. Almost everything is listed inside it.
Good luck.
Joseph_R_Thomas
March 29th, 2004, 10:13 PM
ISMSH : i strongly recommend you get a book and read it first before posting your questions..
really, get a book!
ISMSH
March 29th, 2004, 10:14 PM
Thanks Mr.Craig Gemmill i will try it now :)
Thanks Me.vnInformatics for ur post :)
THANKS GUYS !!! ... lol
:)
ISMSH
March 29th, 2004, 10:20 PM
Hi Mr.Joseph_R_Thomas
why do i have to read a book before i post my qouestion ... is there is somthing wrong !!!
i have no time Mr.Joseph_R_Thomas i work in company for 12 hours a day !!! and i have no time to read ... so i help my self and ppl helps me and i help them sometimes when i can ... and with this way i think i made my self professional in VB6 in just few monthes ... ( With Working on it & and Asking experience ppl )
Thanks for your post :)
ISMSH
March 29th, 2004, 11:20 PM
sorry Mr.Craig Gemmill it didn't worked :(
i don't know why they made it this hard !!!
this way ppl well run away from it i think
no one i met from my friends and they startede the VB.NET most of them come back to VB6 and run away from this !!!
Craig Gemmill
March 29th, 2004, 11:42 PM
You have to make sure you use NEW, as this creates a new, clean, instance of the Form.
Add a button to your form and add the following code. Each time you click the button, a new instance of the form will be shown.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fMyForm as NEW Form2
fMyForm.ShowDialog
End Sub
And as far as you asking questions, that's what a freaking forum is for. Everytime one of your questions is answered, it becomes a resource for someone with the same problem, which is part of what makes the internet so useful.
ISMSH
March 30th, 2004, 12:07 AM
ok Mr.Craig Gemmill i want to show u exactly what have i dont here :
i have to forms ( form1 & form2 )
i put boutton in form one and inside it i write this code :
Dim f As New Form2()
f.ShowDialog()
Me.Close()
well its working and open the form 2
but !!!
it won't close the other form1 its still ON !!!
can you please if u don't mind increase this code to let it work like i want and let it clean the contents in form1 when i come back to form1 ??
i mean like if i have textbox there i and i typed thing on it i want it to be clean when i come back from form2 like that i just started the program again .
and i am very thankful MR.Craig that u r getting that long with me that very kinda of you really
ISMSH
March 30th, 2004, 12:11 AM
Oh small qouestion i forgot to ask ... lol
when i want to keep the contents in form1 like it was when i made change on them i use :
Me.hide
right ?
Craig Gemmill
March 30th, 2004, 12:52 AM
Yes, Me.Hide will maintain all of the current information on the Form.
Now, as far as resetting the Form; I think in your case, you want to just have a function that resets the form, otherwise you are going to have to do a lot of extra work to acheive basically the same result.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim fMyForm As New Form2
'
'Hide current form
'
Me.Hide()
'
'Show the other form
'
fMyForm.ShowDialog()
'
'Now just reset the form
'
Call Me.ResetForm()
End Sub
Private Sub ResetForm()
Me.Text = "Virgin Form"
Me.Size = New Size(800, 800)
Me.CenterToScreen()
Me.Show()
'etc.. Whatever you want to reset
End Sub
Joseph_R_Thomas
March 30th, 2004, 01:05 AM
Originally posted by ISMSH
i have no time Mr.Joseph_R_Thomas i work in company for 12 hours a day !!! and i have no time to read ... so i help my self and ppl helps me and i help them sometimes when i can ... and with this way i think i made my self professional in VB6 in just few monthes ... ( With Working on it & and Asking experience ppl )
Thanks for your post :)
with 19 posts how many pplk did u help? seems all your posts are asking for help:D
anyways, the questions u are asking is very basic, so i thought it might be good for you if you read up a bit, if not from books, then from internet..after all it will benefit you and not me.
depending on forums is not a good idea except for something that you really cant do after lotsa trying(which in your case i dont think you did:D )
but its your life..so continue what you wish to do..ppl here, even me, we will help.:cool:
BTW : i work 15 hrs a day in my company EVERYDAY Mon thru Sat.
lemme know if you wanna join the company i work at:rolleyes:
Joseph_R_Thomas
March 30th, 2004, 01:10 AM
Originally posted by Craig Gemmill
And as far as you asking questions, that's what a freaking forum is for. Everytime one of your questions is answered, it becomes a resource for someone with the same problem, which is part of what makes the internet so useful.
ppl will look in forum for something like .close and .hide??
yea that will happen...:rolleyes:
they'd rather go to MSDN dude:cool:
ISMSH
March 30th, 2004, 01:11 AM
well Mr.Joseph_R_Thomas thanks for your post
i reall like to share ppl but mybe coz i am new in VB.NET so i can't help right now ... but i can in VB.6
also ... lol u worked 15vhours aday is very hard really
but u work from Mon. To Sat
well i am 12 hours aday from Mon. To Mon. ... lol
i have no weekends if u want to know this
coz they want me out ... lol but i won't give them this chance ... lol
else My Manager wants this project at Sat. that means he only gives me 3 dyas ... whats means also he want me OUT OF THE COMPANY !!!
but .... lol ... not me who gona give him this chance ... lol
i can fight for my work :)
thanks again fro u r post :)
Joseph_R_Thomas
March 30th, 2004, 01:13 AM
well dude, if thats the case... post your project! we might as well do it for ya!:D
then you can stick the project on your manager's face:wave:
ISMSH
March 30th, 2004, 01:16 AM
Thanks Mr.Joseph_R_Thomas
i am working on it now with help from Mr. Craig :)
i will answer him shortly ... lol if he didn't get bored of me ... lol
:) :) :)
ISMSH
March 30th, 2004, 01:37 AM
well its working Mr.Craig Gemmill
but not this line it gives me error :
Call Me.ResetForm ()
and where i put this :
Private Sub ResetForm()
Me.Text = "Virgin Form"
Me.Size = New Size(800, 800)
Me.CenterToScreen()
Me.Show()
End Sub
swamivishal1
March 30th, 2004, 08:29 AM
dear friend,
u dont need to write the keyword "call" or "me"
ResetForm ()
will work efficiently
also u can put the function in the same manner as u did earlier with VB6
that is anywhere outside the 'event handler' but within the class.
good luck
and
don't worry
""togather we can and we will win ""
:wave:
ISMSH
March 30th, 2004, 12:29 PM
thanks mr.swamivishal1 i am gona try to do what u said and i hope it work with me :)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.