visual basic tcp server:用多种形式编写全局函数

时间:2022-05-04 13:56:21

i wrote a program to implement a tcp ip server and it is working fine.i need to build a user interface having multiple forms.in my form1,i setup the socket server and its working fine.I need to access the function server.send() (server is the name of my function to send data) in form 2 and form3. what all changes should i make to access it?

我写了一个实现tcp ip服务器的程序,它工作正常。我需要构建一个具有多个窗体的用户界面。在我的form1中,我设置了套接字服务器并且工作正常。我需要访问函数server.send ()(服务器是我发送数据的函数的名称),格式为2和form3。我应该做什么改变来访问它?

(i am using visual basic 2012 express edition)

(我使用的是visual basic 2012快递版)

1 个解决方案

#1


1  

Put the subroutines and functions that you need throughout your project in a Module. If you add a Module to your project and paste your functions and subroutines into it, you'll be able to access those from all of the forms in the project.

将您需要的子程序和函数放在模块中。如果将一个模块添加到项目中并将函数和子例程粘贴到其中,您将能够访问项目中所有表单中的模块。

#1


1  

Put the subroutines and functions that you need throughout your project in a Module. If you add a Module to your project and paste your functions and subroutines into it, you'll be able to access those from all of the forms in the project.

将您需要的子程序和函数放在模块中。如果将一个模块添加到项目中并将函数和子例程粘贴到其中,您将能够访问项目中所有表单中的模块。