Question:
how to wirthe the program below in Visual basic.?
anonymous
2006-07-27 08:00:28 UTC
how to wirthe the program below in Visual basic.?

in visual basic, let's say
when cellx = 0, then celly is also 0 (copied from cell x)
when cellx turn to 3(>0) , celly also turn to 3 (also copied from cellx)
but when cellx turn back to 0 or less than 0
let's say cellx = 0 (turning back again from 3)
celly remain 3 (not copied from cellx, just remained as it is)
so, when cellx = 0 , celly = 3 (celly must remain >0)

eg. cellx = 0, then celly = 0 (first step)
cellx = 3, then celly = 3 (second step) (cellx turn to >0, and celly follow suit)
cellx = 0, then celly = 3 (third step) (although cellx turn back to 0, celly must remain at 3 (>0) )
hope it is clear what i want to know. please find me the answer.
Five answers:
smendonis
2006-07-29 02:45:32 UTC
'How this works:

'dont_return holds the dont return status

'if the dont_return is false then we can change the cellx

'if the dont_return is true then we can not change the cellx

'This will work once in the program. If you wish to reset the

'functionality you will have to reset the dont_return value back to

'False





'Make a command1 button and place under the code

Sub command1_click

'under your first Form1.Load or similar or where you initalize

'your variables place this (or from the original calling point)



dont_return = False ' Our value can change at this moment



'here you place a value for cellx just for test

cellx=2

f=setcelly(cellx)

End Sub



'Under a module or your calling form place and call this



Function setcelly(cellx)

if cellx=0 and dont_return=False then celly=0

if cellx>0 then celly=cellx:dont_return=True

End function



'Under a Module place this

Global dont_return



I hope this helps

Stefanos
Dilip Rao
2006-07-27 15:21:58 UTC
If Cellx <= 0 then GoTo Line1

Celly = Cellx

Line1:





Hope this helps
Joe_Young
2006-07-28 09:26:35 UTC
Learn it yourself here is the link



http://cuinl.tripod.com/tutorials.htm



and furthermore do not use goto fuction like person say above. Use label. Implement like this



If Cellx <= 0 then mylabel

Celly = Cellx



mylabel:

your instructions

end sub
Special Ed
2006-07-27 15:15:32 UTC
You might want to try vbforums.com. I am sure there are people there that can help you with what you need. Just explain it a little more clearly.



Good luck!
green_maths_scout
2006-07-27 15:09:15 UTC
don't know sorry


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...