【发布时间】:2018-12-19 15:41:21
【问题描述】:
我正在使用具有两个表单的 WinForm 应用程序。第一种形式是具有所有逻辑的主要形式。第二个表单包含一个浏览器控件并根据从 Form1 传递的数据访问内部网页。然后可以与网页进行交互。当在 Form1 上弹出 MessageBox 时出现问题,Form2 上的交互被阻止。
有没有办法在 MessageBox 被应答之前启用 Form2 的交互?
OpenBrowser(docIDs, txtID.Text)
Me.Activate()
resultYESNO = MessageBox.Show(Me, questionText, "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If resultYESNO = DialogResult.Yes Then
columnValue = "Y"
ElseIf resultYESNO = DialogResult.No Then
columnValue = "N"
End If
OpenBrowser 子:
Private Sub OpenBrowser(ByVal docIDs As List(Of String), ByVal ID As String)
If Not Application.OpenForms().OfType(Of Browser).Any Then
Dim browser = New Browser()
End If
Dim encodeIDs As String
encodeIDs = String.Join(",", docIDs.ToArray())
Dim barray As Byte() = System.Text.Encoding.UTF8.GetBytes(encodeIDs)
Dim encodedIDs = System.Convert.ToBase64String(barray)
Dim url = ConfigurationManager.AppSettings("MyBrowserPath")
Browser.WebBrowser1.Url = New Uri(url & encodedIDs)
Dim area = Screen.PrimaryScreen.WorkingArea
Dim width = CInt(area.Width / 2)
Dim height = CInt(area.Height)
Browser.Width = width
Browser.Height = 800
Browser.SetDesktopLocation(width, 0)
Browser.Show()
Browser.BringToFront()
Browser.Activate()
End Sub
【问题讨论】:
-
我们昨天不是已经问过这个了吗?
-
那是关于试图用“假”对话框替换对话框。这是在寻找不同的方法。
-
那你为什么在提问之前打开浏览器表单?
-
在回答问题之前需要审核网络表单中的数据
-
很久以前,在一个遥远的星系里,你曾经可以设置旧的 MsgBox 的模态。现在唯一的选择是 ApplicationModal。
标签: .net vb.net winforms showdialog