A forum for the Tanghinian

Welcome to Discuss
Monday, 6 September 2010 @ 05:29 PM HKT


 Forum Index > Computer Lessons > S2 Computer Game Programming New Topic Post Reply
 VB Question
 |  Printable Version
S080056@eClass
 March 03 2010 22:30 PM (Read 380 times)  
Forum Newbie
Newbie

Status: offline

Registered: 03/03/10
Posts: 2

Excuse me, How to set the property of the cancel button of a form?
(When I execute the program, if I click the cancel button in the form, the computer cannot stop running the program!)

Thanks!


 
Profile
Quote
Wong sir
 March 03 2010 23:44 PM  
Forum Chatty
Chatty

Status: offline

Registered: 12/28/06
Posts: 57

....
There is no way to set such property. Do you mean that [X] at the top right-hand corner?

In fact, most students find that the program is still running though they have clicked that [X]!
Very often, these students create some forms, let's say formA, formB and formC. Student will cause formB to load in formA, may be by clicking a button "Go to PLAY" / "Up LEVEL" ...
If the student write in this way:

PHP Formatted Code

me.visible = false
formB.show()
 


since formA is just INVISIBLE, NOT closed! Though you click that [X] in formB, that formA is still running but the form is INVISIBLE.

So, I would prefer just the following:
PHP Formatted Code

formB.showdialog()
 

When user click [X] in formB, the control will go back to formA.

Hope it helps.

In fact, students of my group should know this. All students, not just me, can give answers!


 
Profile Email Website
Quote
S080114@eClass
 March 04 2010 21:19 PM  
Forum Junior
Junior

Status: offline

Registered: 02/12/10
Posts: 18

不如我係學校同你講啦,你個意思係咪話想form2關ge時候,form都關埋,定係form2開左,form1關埋???
如果係2個一齊關,你可以用個event 好似係叫declared...係指如果form2close 時做d咩,你自己打code啦


 
Profile
Quote
Wong sir
 March 04 2010 23:56 PM  
Forum Chatty
Chatty

Status: offline

Registered: 12/28/06
Posts: 57

Haha! Thanks Ling!

In fact, I don't understand much about the question.


 
Profile Email Website
Quote
S080024@eClass
 March 05 2010 18:34 PM  
Forum Newbie
Newbie

Status: offline

Registered: 03/05/10
Posts: 2

hi! Wong sir,
如果click左兩個Picturebox,之後其他ge picturebox都disabled,要點寫code?
thx... ^~^


 
Profile
Quote
S080024@eClass
 March 05 2010 19:19 PM  
Forum Newbie
Newbie

Status: offline

Registered: 03/05/10
Posts: 2

And also, if picturebox1.Show() &picturebox3.Show() then picturebox1.enabled=False & picturebox.enabled=false 要點寫?
佢會話if吾得用Show/Visible/backgroundimage/image
but my game is 卡片對對碰,how can i do it? Question
thx... Big Grin


 
Profile
Quote
S080114@eClass
 March 05 2010 21:24 PM  
Forum Junior
Junior

Status: offline

Registered: 02/12/10
Posts: 18

我有個傻ge方法,就係先dim x as integer
click 一次個picturebox
x=x+1

if x=2 then picturebox(x).visible=false


 
Profile
Quote
Wong sir
 March 06 2010 14:31 PM  
Forum Chatty
Chatty

Status: offline

Registered: 12/28/06
Posts: 57

唔多明~

Do you mean that you want to show 2 pictures. Then check if the 2 pictures are visible, then set these 2 to invisible? If so, write the following:
If PictureBox1.Visible = True And PictureBox2.Visible = True Then
PictureBox1.Visible = False
PictureBox2.Visible = False
End If

If you want to visible when invisible and set to invisible when visible (Toggle between on / off)
If PictureBox1.Visible = True And PictureBox2.Visible = True Then
PictureBox1.Visible = False
PictureBox2.Visible = False
ElseIf PictureBox1.Visible = False And PictureBox2.Visible = False Then
PictureBox1.Visible = True
PictureBox2.Visible = True
End If

Hope it helps!

Wong sir


 
Profile Email Website
Quote
Content generated in: 1.30 seconds
New Topic Post Reply



 All times are HKT. The time is now 05:29 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Full HTML Allowed 
Censored Content