如何将表单文本发送到模块 [英] How do I send the text of form to module

查看:60
本文介绍了如何将表单文本发送到模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 我要在这里输入文字

 hi i want text here 

"name"

Public Property name() As String
        Get
            Return "name"
        End Get
        Set(value As String)
        End Set
    End Property

推荐答案

表单是类,必须使用与所有类相同的规则.以下是两个表单项目,其中我使用表单的实例传递数据.在模块和表单之间将应用相同的规则.

Forms are classes and the same rules as all class must be used.  Below is a two form project where I use an instance of the form to pass data.  The same rules would apply between a module and a form.

表格1

Public Class Form1

    Dim form2 As Form2
    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        form2 = New Form2(Me)

    End Sub


    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        form2.Show()
        Dim results As String = form2.GetData()

    End Sub
End Class

Form2

Public Class Form2


    Dim form1 As Form1
    Sub New(nform1 As Form1)
        ' This call is required by the designer.
        InitializeComponent()
        AddHandler Me.FormClosing, AddressOf Form2_FormClosing
        form1 = nform1
        form1.Hide()
    End Sub

    Private Sub Form2_FormClosing(sender As Object, e As FormClosingEventArgs)
        'stops form from closing
        E.Cancel = True
        Me.Hide()
    End Sub

    Public Function GetData() As String
        Return "The quick brown fox jumped over the lazy dog"
    End Function



End Class



这篇关于如何将表单文本发送到模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆