vb.net-Can';t从另一个窗体访问自定义窗体属性/方法

vb.net-Can';t从另一个窗体访问自定义窗体属性/方法,vb.net,Vb.net,我有一个vb.net表单,其中包含以下代码: Imports System.Data.Common Imports System.Data.OleDb Imports System.Drawing.Printing Public Class frmTransAlqPago Private dt As DataTable Private da As OleDbDataAdapter Private BaseDatos As String Private cPro

我有一个vb.net表单,其中包含以下代码:

Imports System.Data.Common
Imports System.Data.OleDb
Imports System.Drawing.Printing

Public Class frmTransAlqPago
    Private dt As DataTable
    Private da As OleDbDataAdapter
    Private BaseDatos As String

    Private cProp As cPropietario
    Private cAlqu As cAlquiler
    Private cClie As cCliente
    Private cPrda As cPropiedad

#Region "Propiedades"
    Private mvarIDAlqu As Long
    Private mvarIDClie As Long
    Private mvarIDProp As Long
    Private mvarIDPrda As Long
    Private mvarFecDeu As Date
    Public WriteOnly Property pIDAlqu() As Long
        Set(ByVal value As Long)
            mvarIDAlqu = value
        End Set
    End Property
    Public WriteOnly Property pIDClie() As Long
        Set(ByVal value As Long)
            mvarIDClie = value
        End Set
    End Property
    Public WriteOnly Property pIDProp() As Long
        Set(ByVal value As Long)
            mvarIDProp = value
        End Set
    End Property
    Public WriteOnly Property pIDPrda() As Date
        Set(ByVal value As Date)
            mvarpIDPrda = value
        End Set
    End Property
    Public WriteOnly Property pFecDeu() As Long
        Set(ByVal value As Long)
            mvarFecDeu = value
        End Set
    End Property
#End Region
    Private Sub mObtieneObjetos()

        cClie.mClienteGet(CType(txtIDClie.Text, Integer))
        cAlqu.mAlqPagoGet(CType(txtIDAlqu.Text, Integer))
        cPrda.mPropGet(CType(txtIDPrda.Text, Integer))
        cProp.mGetPropietario(CType(txtIDProp.Text, Integer))

    End Sub
...
...
...
另一种形式是:

    Private Sub btnImprimir_Click(sender As Object, e As EventArgs) Handles btnImprimir.Click
        Dim frm As Form = New frmTransAlqPago
        frm.Controls.Item("txtIDAlqu").Text = CType(dgvVarios.CurrentRow.Cells.Item(4).Value, Integer)
        frm.Controls.Item("txtIDPrda").Text = CType(dgvVarios.CurrentRow.Cells.Item(5).Value, Integer)
        frm.Controls.Item("txtIDClie").Text = CType(dgvVarios.CurrentRow.Cells.Item(6).Value, Integer)
        frm.Controls.Item("txtIDProp").Text = CType(dgvVarios.CurrentRow.Cells.Item(7).Value, Integer)
        frm.Controls.Item("txtAlqRec").Text = CType(dgvVarios.CurrentRow.Cells.Item(0).Value, Integer)

        frm.pfecdeu = CType(dgvVarios.CurrentRow.Cells.Item(0).Value, Integer)
最后一条指令给了我一个错误。事实上,autocomplete函数不能识别frm.pFecDeu 那么,如何将自定义属性/方法从一个表单访问到另一个表单呢?我正在Visaul Studio 2015中编写代码


谢谢

我认为您的问题是
因为Form=New frmTransAlqPago


我的解决方案是
Dim frm As frmTransAlqPago=New frmTransAlqPago

哦!接得好!感谢您可以将其缩短为
将frm变暗为新的frmTransAlqPago
。那么您只需键入一次类型。。。