PdotWang 17 Newbie Poster

I do not understood him until now (I think I do, maybe wrong again.)

He said, “when I click "F2" then the key of "F12" and a button is enabled=false”

My understanding is:

If the user press F2 and then (within 100 ms, for example) press F12 continuously, then disable the button.

Please confirm me, sarifah.

If I were to do it, I need a class scope variable bF2Clicked (Boolean). I may need a timer also.

bF2Clicked = False at Form Load
bF2Clicked = True at Form Load, and timer start.
bF2Clicked = False at timer stop.
Button1.Enable = False if bF2Clicked = True And Key = F12.
PdotWang 17 Newbie Poster

What is the F12 is doing? Would you please post that piece of code?

I guess what you need is something like:

If ThatButton.Enabled then
‘do the job
End If
PdotWang 17 Newbie Poster

I will not post an answer for this one, because I saw enough code. What is missing here is just "a nonsense thing other than a answer".

You come to here for an answer, which is good. But the answer is not free. You need to pay with your own effort. That is a common sense, not a "nonsense". Get it?

This one should be solved now.

swathys commented: i don't prefer a nonsence answer from you too....u got it !! +0
debasisdas commented: thanks for the counter NONSENSE campaign. +9
PdotWang 17 Newbie Poster

I apologize I don't know how I missed that.
What I did was set a form up to be my projects main form but the form is never used and is always hidden.
Instead of showing the main form on load I showed form1.
When doing this you can close and load forms as you please without having the application close, as long as you don't touch the main form(the hidden one). And when you want to exit your application you just use.

Application.Exit()

There is probably a better way to do this, but not one that I know of.

You have said, "set a form up to be my projects main form but the form is never used and is always hidden." But what if at some point there is bug and it closes all of the visible forms but not call Application.Exit(). The app will be running forever, isn't it?

Thanks for the tip. It may be useful for some other ways.

PdotWang 17 Newbie Poster

Use My.Settings for the purpose.
You can binding a property of the Form to a setting in design time.
Project > appName Properties > Settings
Then
Form > Properties > Application Settings > Choose the property and the setting

OR, you can bind in code.

PdotWang 17 Newbie Poster

"what is the point of being NULL? Why set it to zero?"

Sometimes, you need to know if a number (say a) has a correct value of 0, or it has nothing yet.

You may want to use, for example, if a is null, then doing job A, or else, doing job B.

I do not think any compiler is doing the right thing by automatically initialize integers to 0. It is just like to initialize any object to a EMPTYCLASS but not to NULL.