question

osvbnet avatar image
0 Votes"
osvbnet asked karenpayneoregon answered

Public Function not accessible in other forms?

Hello experts,
Any idea why this public function is not accessible in other forms?

Public Declare Function SetThreadExecutionState Lib "kernel32" (ByVal esFlags As EXECUTION_STATE) As EXECUTION_STATE
Public Enum EXECUTION_STATE
ES_AWAYMODE_REQUIRED = &H40
ES_SYSTEM_REQUIRED = &H1
ES_DISPLAY_REQUIRED = &H2
ES_CONTINUOUS = &H80000000
End Enum

So this usage is OK?

Form1.SetThreadExecutionState(Form1.EXECUTION_STATE.ES_CONTINUOUS)

or it's better to use the whole above code as private in each form?

  • Update: using it on other forms does not work, no effect, pretty confused :(

Thanks :)

dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered

Place it in a code module in your project and use it from there.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.