Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 如何使主窗体等待我创建的自定义对话框的结果?_Vb.net_Winforms - Fatal编程技术网

Vb.net 如何使主窗体等待我创建的自定义对话框的结果?

Vb.net 如何使主窗体等待我创建的自定义对话框的结果?,vb.net,winforms,Vb.net,Winforms,我正在尝试制作一个搜索功能,它有两个以上的开放式选项,在我为两个选项实现它之前,我想让它为其中一个工作,这是可以理解的 我决定做的是创建一个自定义对话框,并使用它来显示输入的搜索条件产生的列表 以下是调用该对话框的代码: Sub search(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click Dim temp As String Dim tempSplit As String() D

我正在尝试制作一个搜索功能,它有两个以上的开放式选项,在我为两个选项实现它之前,我想让它为其中一个工作,这是可以理解的

我决定做的是创建一个自定义对话框,并使用它来显示输入的搜索条件产生的列表

以下是调用该对话框的代码:

Sub search(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
    Dim temp As String
    Dim tempSplit As String()
    Dim check As Boolean = False
    'instance creation of dialog box
    Dim extendSearch As New TypeClassSearch()
    Select Case cmbSearch.Text
        Case "Name"
            'working and appropiate code
            Exit Select

        Case "Number"
            'working and appropriate code
            Exit Select

        Case "Type"
            check = True
            'shows dialog
            extendSearch.Show()
            'doesn't wait for input from the dialog and just goes through the code before user can interact
            If extendSearch.DialogResult() = System.Windows.Forms.DialogResult.OK Then
                For i As Integer = 0 To pokemonList.Length - 1
                    If extendSearch.selection = pokemonList(i) Then
                        temp = weaknesses(i)
                        tempSplit = temp.Split(CChar("\"))
                        weaknesses(i) = ""
                        For k As Integer = 0 To tempSplit.Length - 1
                            If k <> tempSplit.Length - 1 Then
                                weaknesses(i) += tempSplit(k) + ", "
                            Else
                                weaknesses(i) += tempSplit(k)
                            End If
                        Next
                        temp = resist(i)
                        tempSplit = temp.Split(CChar("\"))
                        resist(i) = ""
                        For k As Integer = 0 To tempSplit.Length - 1
                            If k <> tempSplit.Length - 1 Then
                                resist(i) += tempSplit(k) + ", "
                            Else
                                resist(i) += tempSplit(k)
                            End If
                        Next
                        lblNum.Text = pokedexNum(i)
                        lblPkmn.Text = pokemonList(i)
                        lblType.Text = typings(i)
                        lblClass.Text = classifications(i)
                        lblWeak.Text = weaknesses(i)
                        lblResist.Text = resist(i)
                        lblPkdxX.Text = pokedexX(i)
                        lblPkdxY.Text = pokedexY(i)
                    End If
                Next
            End If

                Exit Select
        Case "Class"
                'hold code, next extended criteria
                Exit Select
    End Select

    If check = False Then
        MessageBox.Show("Pokemon Not Found. Please check your spelling or try again.")
    End If
End Sub

任何帮助都将不胜感激。=)

更改,
extendSearch.Show()
extendSearch.ShowDialog()

哇,这是一个很容易解决的问题。。。不过,谢谢!当你的回答让我满意时,我会接受的。
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        selection = CStr(chkSearch.SelectedItem)
        Me.Close()
    End Sub