我有一个带有取消按钮的对话框,如下所示:
Dim dlgSizSelection As New dlgTyreSizeSelection(objCarWebVehicle.Tyres, objCarWebVehicle)
If (dlgSizSelection.ShowDialog) = Windows.Forms.DialogResult.OK Then
selectedTyre = CType(dlgSizSelection.lstTyreOptions.SelectedItem, CarWebVehicleCOM.TyreData)
dlgSizSelection.Close()
ElseIf (dlgSizSelection.ShowDialog) = Windows.Forms.DialogResult.Cancel Then
dlgSizSelection.Close()
Exit Sub
Else
MsgBox("No tyre sizes selected.", MsgBoxStyle.Exclamation, "Tyre Search")
dlgSizSelection.Close()
Exit Sub
End If
但是,当我在表单中设置 DialogReturn 属性时,它的调用如下:
DialogResult = Windows.Forms.DialogResult.Cancel
然后按取消按钮,它会短暂闪烁,然后对话框重新出现,就像我什么都没按一样,为了让它完全关闭,我必须再按一次。
我错过了什么?