从互联网更新数据 [英] update data from internet

查看:69
本文介绍了从互联网更新数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个具有列表框和按钮的C#程序,当我单击按钮时,它将使用文件中的数据更新列表框
像这样的东西:
http://www.up.iranblog.com/images/yqadtgtg0ikq9qcg9m0u.rar
请帮助我

I want to create a C# program that has list box and button, when I click button it update list box with data from file
something like this:
http://www.up.iranblog.com/images/yqadtgtg0ikq9qcg9m0u.rar
please help me

推荐答案

您需要使用类System.Net.HttpWebRequest.要创建一个,您需要使用类System.Net.WebRequest的编译时变量及其静态工厂方法Create,因为运行时类型是由URI定义的.您System.Net.HttpWebRequest.Method应该是"GET".

在这里找到代码示例: http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx [ ^ ].

—SA
You need to use the class System.Net.HttpWebRequest. To create one, you need to use the compile-time variable of the class System.Net.WebRequest and its static factory method Create, as the run-time type is defined by the URI. You System.Net.HttpWebRequest.Method should be "GET".

Find a code sample here: http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].

—SA


假设您使用的是Visual Studio版本,则至少应有一个包含ListboxButtonForm事件处理代码.然后,您将需要编写更多代码来接收数据,如有必要,对其进行解析,然后填充列表框.我猜您将使用 Web浏览器 [ ^ ]控件可以访问您的互联网数据.
Assuming you have a version of Visual Studio, then you should at least have a Form containing a Listbox and Button with some event handling code. You will then need to write some more code to receive your data, parse it if necessary, and populate your listbox. I would guess you will be using a WebBrowser[^] control to get access to your internet data.


这篇关于从互联网更新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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