VB.NET中的构造函数值 [英] Constructor values in VB.NET

查看:100
本文介绍了VB.NET中的构造函数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两行是一种形式..





这两行


我尝试过:



i尝试传递按钮点击



drawfencec是一个函数,而FrmGoogleMap是一个类

行fParallelLines1和fParallelLines2这些行我想以另一种形式传递..这些行在表单上绘制另外两行。因为我无法传递整个代码我只是粘贴特定的部分..现在我想如何通过构造函数在按钮单击事件上传递这两行

these two lines are in one form ..


these two lines

What I have tried:

i try to pass on button click

drawfencec is a function and FrmGoogleMap is the class
the lines fParallelLines1 and fParallelLines2 these lines i want to pass in another form .. these lines draw another two lines on form . as i cannot pass whole code i just paste specific part .. now i want to that how to pass these two line on another through constructor on button click event

推荐答案

创建FrmGoogleMap类的构造函数,它带有两个参数:

Create a constructor for the FrmGoogleMap class which takes two parameters:
Public Class FrmGoogleMap 
    Private fParallelLines1 As List(Of PointLatLng)
    Private fParallelLines2 As List(Of PointLatLng)
    Public Sub New(ByVal pl1 As List(Of PointLatLng), ByVal pl2 As List(Of PointLatLng))
        fParallelLines1 = pl1
        fParallelLines2 = pl2
    End Sub



然后在创建实例时传递它们:


Then just pass them when you create the instance:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim f As New FrmGoogleMap(fParallelLines1, fParallelLines2) 
    f.Show
    f.DrawFence()
End Sub


这篇关于VB.NET中的构造函数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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