通过TCP / IP从client_app读取server_app的控件? [英] Read controls of server_app from client_app over TCP/IP ?

查看:106
本文介绍了通过TCP / IP从client_app读取server_app的控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,所有代码项目专家。我需要一些帮助来从client_side应用程序通过TCP访问server_side应用程序的控件值(Textbox,DatagridView)。我怎么能这样做?



寻找一些想法,也许还有代码或链接引导我这个。



我的服务器与本地数据库连接,将数据保存到数据库中。并将其价值反映到像TEXTBOX,DATAGRIDVIEW这样的server_control。



我想从客户端访问这些datagridview值。



用于教我的Ty代码项目。



我尝试过:



我尝试了两个单独的项目客户端和服务器,并通过TCP \ IP发送消息。

通过TCP \IP共享文件。但是当我试图读取datagridvalue时它没有输出。

代码:

0到DataGridView1.Rows.Count() - 1步+1

for j As Integer = 0 To DataGridView2.Rows.Count() - 1 Step +1

Next



DataGridView2.Rows。添加(DataGridView1.Rows(i).Cells(0).Value.ToString(),

DataGridView1.Rows(i).Cells(1).Value.ToString(),

DataGridView1.Rows(i).Cells(2).Value.ToString())

Good morning to all codeproject expert. I need some help down here to access controls value (Textbox, DatagridView) of server_side application from client_side application over TCP. How can I do this ?

Looking for some ideas and maybe code or links that lead me to this.

Well My server is connected with a local database where its saving all information into the database. And reflecting its value to server_controls like TEXTBOX, DATAGRIDVIEW.

I want to access those datagridview values from client.

Ty codeproject for teaching me.

What I have tried:

I have tried two separate projects client and server and send messages over TCP\IP.
Shared file over TCP\IP. but when Im trying to read datagridvalue its give no output.
Code:
0 To DataGridView1.Rows.Count() - 1 Step +1
For j As Integer = 0 To DataGridView2.Rows.Count() - 1 Step +1
Next

DataGridView2.Rows.Add(DataGridView1.Rows(i).Cells(0).Value.ToString(),
DataGridView1.Rows(i).Cells(1).Value.ToString(),
DataGridView1.Rows(i).Cells(2).Value.ToString())

推荐答案

你不会那样做。



首先,非常奇怪的是你甚至在服务器应用程序中有UI控件。



您无法在客户端应用程序AT ALL中引用服务器应用程序中使用的控件。您不能关心服务器应用程序中的控件。您要执行此操作的唯一方法是服务器应用程序必须通过TCP / IP公开命令接口,有点像CMD提示。您的客户端向服务器应用程序发送命令,服务器使用序列化数据副本进行响应。它实际上与控件完全无关。



您的客户端应用程序然后反序列化数据并在其自己的控件中显示它想要的任何内容。
You're not going to do it like that.

First, the very odd thing is that you even have UI controls in a server application.

You cannot reference the controls used in the server app in your client application AT ALL. You cannot be concerned with the controls in the server app. The ONLY way you're going to do this is the server app has to expose a command interface over TCP/IP, kind of like a CMD prompt. Your client sends a command to the server app and the server responds with a serialized copy of the data. It actually has nothing to do with the controls at all.

Your client app then deserializes the data and shows whatever it wants in its own controls.


这篇关于通过TCP / IP从client_app读取server_app的控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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