Visual Basic的基本延迟命令

Bra*_*yen 1 vb.net visual-studio

我需要一个适合我的Visual Basic等待命令.

我知道:

Declare Sub Sleep Lib "kernel32.dll" (ByVal milliseconds As Long)
sleep 5000
Run Code Online (Sandbox Code Playgroud)

但这使得该计划没有反应.

System.Threading.Thread.Sleep(5000) 'The window doesn't load until the timing is over (useless)
Run Code Online (Sandbox Code Playgroud)

我的代码:

Imports Microsoft.Win32 'To check if is 64Bit or 32Bit

Public Class Loading
  Private Sub Loading_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    If Registry.LocalMachine.OpenSubKey("Hardware\Description\System\CentralProcessor\0").GetValue("Identifier").ToString.Contains("x86") Then
      My.Settings.Is64 = False
    Else
      My.Settings.Is64 = True
    End If

    'I need command here

    If My.Settings.Is64 = True Then
      Form64.Show()
      Me.Close()
    Else
      MsgBox("No version developed for 32-bit computers.")
      End
    End If
  End Sub
End Class
Run Code Online (Sandbox Code Playgroud)

错误:

@Idle_Mind

1. function 'OnInitialize' cannot be declared 'Overrides' because it does not override a function in a base class.
2.  'MinimumSplashScreenDisplayTime' is not a member of 'App.Loading.MyApplication'.
    3.  'OnInitialize' is not a member of 'Object'.
Run Code Online (Sandbox Code Playgroud)

Idl*_*ind 7

您是否尝试实施启动画面? - > @ChrisDunaway是的,我正在做一个闪屏.

进入项目属性并将主窗体保留为Startup表单.将启动画面窗体设置为底部的启动画面条目.现在单击右侧的"查看应用程序事件"按钮并覆盖OnIntialize,以便您可以像这样设置MinimumSplashScreenDisplayTime():

Namespace My

    ' The following events are available for MyApplication:
    ' 
    ' Startup: Raised when the application starts, before the startup form is created.
    ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
    ' UnhandledException: Raised if the application encounters an unhandled exception.
    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. 
    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
    Partial Friend Class MyApplication

        Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
            ' Set the display time to 5000 milliseconds (5 seconds). 
            Me.MinimumSplashScreenDisplayTime = 5000
            Return MyBase.OnInitialize(commandLineArgs)
        End Function

    End Class


End Namespace
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参见此处