如何返回(向后移动)具有值的表单 [英] how to go back (move back) to a form with a value
问题描述
我面临一个严重的查询窗口问题,请帮忙解决这个问题。
看到我的表格打开的步骤
1.打开第一张表格(来自仪表板)
Dim ObjOrder As New OrderFormFrm
ObjOrder.USER = USER
ObjOrder.Show()
接下来我必须根据文本框事件打开一个popwindow。
Private Sub txtCustCode_MouseClick(ByVal sender As Object,ByVal e As System.Windows.Forms.MouseEventArgs)处理txtCustCode.MouseClick
Dim PopUpCustomer As New searchCustomerfrm
PopUpCustomer.ShowDialog()
End Sub
3.我必须goback具有基于gridview行点击事件的值的Orderform
Private Sub DGVCustomer_CellContentDoubleClick(ByVal sender As Object,ByVal e As System.Windows.Forms.DataGridViewCellEve ntArgs)处理DGVCustomer.CellContentDoubleClick
OrderFormFrm.txtCustCode.Text = Val(DGVCustomer.Item(1,e.RowIndex).Value)`
Me.Close()
结束次级
问题是,当我从'OrderFormFrm'(项目属性设置 - 开始表单)启动项目表单时,我正在获得Orderform文本框的价值,如果我从仪表板启动项目,则无法获得。
我需要在订单表格中显示值'DGVCustomer.Item(1,e.RowIndex).Value'文本框'txtCustCode'
Please帮助解决这个问题
I am facing a serious issue with a lookup window, Please help to solve this.
see the steps of my form opens
1. Opens first form (from Dashboard)
Dim ObjOrder As New OrderFormFrm
ObjOrder.USER = USER
ObjOrder.Show()
Next I have to open a popwindow based on a textbox event.
Private Sub txtCustCode_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtCustCode.MouseClick
Dim PopUpCustomer As New searchCustomerfrm
PopUpCustomer.ShowDialog()
End Sub
3. I have to goback to Orderform with a value based on a gridview row click event
Private Sub DGVCustomer_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVCustomer.CellContentDoubleClick
OrderFormFrm.txtCustCode.Text = Val(DGVCustomer.Item(1, e.RowIndex).Value)`
Me.Close()
End Sub
The problems is, I am getting value to Orderform's textbox when I start project form from 'OrderFormFrm' (project properties setting-start form), and not getting if I started project from the dashboard.
I need to display the value 'DGVCustomer.Item(1, e.RowIndex).Value' in Order forms text box 'txtCustCode'
Please help to solve this
推荐答案
由朋友解决这个问题,
我可以在searchCustomerfrm表单,它返回您希望从表单中获得的值:
公共共享函数GetCustomer()
Dim PopUpCustomer As新的searchCustomerfrm
如果PopUpCustomer.ShowDialog()= DialogResult.OK那么
返回Val(PopUpCustomer.DGVCustomer.Item(1,PopUpCustomer.DGVCustomer.CurrentRow.Index).Value )
否则
不返回
结束如果
结束功能
Solved this by a friend,
I could make a shared function on the searchCustomerfrm form that returns the value that you expect from the form:
Public Shared Function GetCustomer()
Dim PopUpCustomer As New searchCustomerfrm
If PopUpCustomer.ShowDialog() = DialogResult.OK Then
Return Val(PopUpCustomer.DGVCustomer.Item(1, PopUpCustomer.DGVCustomer.CurrentRow.Index).Value)
Else
Return Nothing
End If
End Function
On the DGVCustomer_CellContentDoubleClick write this:
Private Sub DGVCustomer_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVCustomer.CellContentDoubleClick
Me.DialogResult = DialogResult.OK
End Sub
To call the searchCustomerfrm from OrderFormFrm:
txtCustCode.Text = searchCustomerfrm.GetCustomer
这篇关于如何返回(向后移动)具有值的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!