|
-
Oct 16th, 2006, 04:58 PM
#1
Thread Starter
Lively Member
[Resolved] Error with some codes...
1- Suppose that I am working in form1... this code is not working:
VB Code:
Private sub command1_Click()
form2.command2_Click
End sub
Is there any other way to do that?
2- I used form properties to load a picture... but now I changed my mind and I don't want to load any picture... However, I tried to unload it!!! but I can't do that!!! This appears always and I can't delete it (Picture: (Bitamp))
Last edited by XShadow; Oct 19th, 2006 at 12:52 PM.
-
Oct 16th, 2006, 05:28 PM
#2
PowerPoster
Re: Error with some codes...
 Originally Posted by XShadow
1- Suppose that I am working in form1... this code is not working:
VB Code:
Private sub command1_Click()
form2.command2_Click
End sub
Is there any other way to do that?
2- I used form properties to load a picture... but now I changed my mind and I don't want to load any picture... However, I tried to unload it!!! but I can't do that!!! This appears always and I can't delete it (Picture: (Bitamp))
1) put the command2 code into a public sub (module) and then call the sub in the click event
2) if you want to clear the forms picture property, do this:
VB Code:
Form1.Picture = LoadPicture("")
-
Oct 16th, 2006, 05:30 PM
#3
Re: Error with some codes...
If you change command2_Click to a Public sub you can do
form2.command2_Click = True
-
Oct 16th, 2006, 05:39 PM
#4
Re: Error with some codes...
Are you trying to call the click event? Then you should simply try:
VB Code:
Private Sub Command1_Click
Form2.Command2 = True
End Sub
-
Oct 16th, 2006, 05:41 PM
#5
Re: Error with some codes...
 Originally Posted by gavio
Are you trying to call the click event? Then you should simply try:
VB Code:
Private Sub Command1_Click
Form2.Command2 = True
End Sub
See post #3
-
Oct 16th, 2006, 05:45 PM
#6
Re: Error with some codes...
 Originally Posted by XShadow2
2- I used form properties to load a picture... but now I changed my mind and I don't want to load any picture... However, I tried to unload it!!! but I can't do that!!! This appears always and I can't delete it (Picture: (Bitamp))
Select the property, then press the Delete key twice.
-
Oct 16th, 2006, 05:49 PM
#7
Re: Error with some codes...
 Originally Posted by MartinLiss
See post #3
Yeah, but there's no need to change it to Public 
edit: Btw... form2.command2_Click = True doesn't work for me, even if Command2_Click is Public.
-
Oct 16th, 2006, 05:52 PM
#8
Re: Error with some codes...
 Originally Posted by gavio
Yeah, but there's no need to change it to Public
edit: Btw... form2.command2_Click = True doesn't work for me, even if Command2_Click is Public.
.. but that will load Form2 in memory and you should not forget to unload it. 
Edit: Marty meant, make the Sub Public and under click event, just call the event name, ie. form2.command2_click
-
Oct 16th, 2006, 05:56 PM
#9
Re: Error with some codes...
 Originally Posted by gavio
Yeah, but there's no need to change it to Public
edit: Btw... form2.command2_Click = True doesn't work for me, even if Command2_Click is Public.
You're right and what you need to do is
Form2.Command2 = True
-
Oct 16th, 2006, 05:59 PM
#10
Re: Error with some codes...
 Originally Posted by Harsh Gupta
.. but that will load Form2 in memory and you should not forget to unload it. 
True... but, if you have a form, don't you want to have it in the memory? If not, what's the point of it? You can always simply loop through all forms and unload each one when closing the app.
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
|