我创建了一个对话框,并尝试通过以下代码调用:
Dim intResult as Integer = frmData.ShowDialog() Debug.Writeline(intResult)但是,似乎我只能返回DialogResults(中止,取消,忽略...)
我想知道如何无需创建一个公共变量并存储结果就可以尝试,
解决方案>在对话框中创建一个返回值的属性。
如果frmData.ShowDialog()不是DialogResult。取消 Dim值as integer = frmData.MyProperty ... Endif
I have a form that has a button, when clicked it pops up a Dialog Form. Within this dialog form the user needs to select some data and when the user is finished they click the OK button. Once they click the OK button it needs to return an integer back to the previous form.
I created a Dialog Form and tried calling it via the code below:
Dim intResult as Integer = frmData.ShowDialog() Debug.Writeline(intResult)However, it seems I can only return DialogResults (Abort, Cancel, Ignore...)
I was wondering how I can try this without having to create a public variable and storing the result there.
解决方案Create a property on the Dialog that will return the value.
If frmData.ShowDialog() Is Not DialogResult.Cancel Dim value as integer = frmData.MyProperty ... Endif
更多推荐
在VB.NET表单之间传递数据
发布评论