资源简介
能够实时获取股票数据
代码片段和文件信息
using System;
using System.Collections;
using System.Data;
using System.IO;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string one;
private void button1_Click(object sender EventArgs e)
{
// try
//{
one = (textBox1.Text.Substring(0 3));
if (one == “600“ || one == “601“ || one == “603“ || one == “900“)
{
one = “sh“ + textBox1.Text;
timer1.Start();
}
else if (one == “000“ || one == “200“)
{
one = “sz“ + textBox1.Text;
timer1.Start();
}
else
{
//textBox1.Text = “请输入股票代码“;
}
// }
//catch
// {
// textBox1.Text = “请输入股票代码“;
//}
}
private void getHTMLbyWebRequest(string strUrl)
{
Encoding encoding = System.Text.Encoding.Default;
WebRequest request = WebRequest.Create(strUrl);
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);//导入gb2312
encoding = Encoding.GetEncoding(“GB2312“);//貌似用GB2312就可以
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream encoding);
string responseFromServer = reader.ReadToEnd();
responseFromServer=responseFromServer.Replace(“var hq_str_“““);
responseFromServer = responseFromServer.Trim().Replace(“00\“;“ ““);
responseFromServer = responseFromServer.Replace(“=\““ ““);
string[] strn = responseFromServer.Split(‘‘);
string[] strm = {“代码:““名称:““今日开盘价:““昨日收盘价:““当前价格:““今日最高价:““今日最低价:““竞买价,即“买一”报价:““竞卖价,即“卖一”报价:““成交的股票数:““成交金额:““买一:““买一价:““买二:““买二价:““买三:““买三价:“
“买四:““买四价:““买五:““买五价:““卖一:““卖一价:““卖二:““卖二价:““卖三:““卖三价:““卖四:““卖四价:““卖五:““卖五价:““日期:““时间:“};
Hashtable hs = new Hashtable();
for(int i = 0; i < strm.Length; i++)
{
hs.Add(strm[i] strn[i]);
}
int j = 0;
foreach (System.Windows.Forms.Control control in this.Controls)//遍历groupBox2上的所有控件
{
if (control is System.Windows.Forms.Label)
{
if (j < strm.Length) {
control.Text = strm[j]+strn[j];
j++;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-11-05 17:12 WindowsFormsApp2\
目录 0 2020-11-05 10:42 WindowsFormsApp2\.vs\
目录 0 2020-11-05 13:38 WindowsFormsApp2\.vs\WindowsFormsApp2\
目录 0 2020-11-05 13:38 WindowsFormsApp2\.vs\WindowsFormsApp2\DesignTimeBuild\
文件 72664 2020-11-05 13:38 WindowsFormsApp2\.vs\WindowsFormsApp2\DesignTimeBuild\.dtbcache.v2
目录 0 2020-11-05 10:42 WindowsFormsApp2\.vs\WindowsFormsApp2\v16\
文件 33280 2020-11-05 17:12 WindowsFormsApp2\.vs\WindowsFormsApp2\v16\.suo
文件 20984 2020-11-05 17:12 WindowsFormsApp2\Form1.Designer.cs
文件 4437 2020-11-05 15:21 WindowsFormsApp2\Form1.cs
文件 2816 2020-11-05 15:21 WindowsFormsApp2\Form1.resx
文件 603 2020-11-05 10:42 WindowsFormsApp2\Program.cs
目录 0 2020-11-05 15:20 WindowsFormsApp2\Properties\
目录 0 2020-11-05 15:21 WindowsFormsApp2\Properties\PublishProfiles\
文件 431 2020-11-05 15:21 WindowsFormsApp2\Properties\PublishProfiles\FolderProfile.pubxm
文件 203 2020-11-05 15:21 WindowsFormsApp2\Properties\PublishProfiles\FolderProfile.pubxm
文件 242 2020-11-05 10:42 WindowsFormsApp2\WindowsFormsApp2.csproj
文件 452 2020-11-05 15:21 WindowsFormsApp2\WindowsFormsApp2.csproj.user
文件 1137 2020-11-05 10:42 WindowsFormsApp2\WindowsFormsApp2.sln
目录 0 2020-11-05 15:21 WindowsFormsApp2\bin\
目录 0 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\
目录 0 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\
文件 440 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\WindowsFormsApp2.deps.json
文件 15872 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\WindowsFormsApp2.dll
文件 174592 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\WindowsFormsApp2.exe
文件 13800 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\WindowsFormsApp2.pdb
文件 190 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\WindowsFormsApp2.runtimeconfig.dev.json
文件 161 2020-11-05 15:20 WindowsFormsApp2\bin\Debug\netcoreapp3.1\WindowsFormsApp2.runtimeconfig.json
目录 0 2020-11-05 15:21 WindowsFormsApp2\bin\Release\
目录 0 2020-11-05 15:21 WindowsFormsApp2\bin\Release\netcoreapp3.1\
文件 440 2020-11-05 15:21 WindowsFormsApp2\bin\Release\netcoreapp3.1\WindowsFormsApp2.deps.json
文件 15360 2020-11-05 15:21 WindowsFormsApp2\bin\Release\netcoreapp3.1\WindowsFormsApp2.dll
............此处省略44个文件信息
- 上一篇:interop.acropdflib
- 下一篇:VIN固定资产管理系统源码
相关资源
- 调用百度地图API进行批量经纬度获取
- WinAPI 获取光标形状
- C#调用delphi生成的dll获取CPU序列号
- 根据出生日期获取星座和生肖,农历
- 微信公众平台网页授权获取用户基本
- C# 计算机软硬件信息获取
- C#股票K线走势加技术指标源码
- C#生成PDF 读取PDF文本内容 获取PDF内图
- 天气预报源码、包括从IP获取天气预报
- C#生成PDF 读取PDF文本内容 获取PDF内图
- C#实时获取CPU温度及其它硬件信息非
- 股票数据接口库NTuShare
- C# NTP 时钟同步 获取指定IP系统时间
- c#联合halcon编程,鼠标获取图像灰度值
- c# 采集核心源码 获取超连接
- 通过PJL协议,获取惠普USB打印机状态
- c#Winform获取摄像头扫描各种码
- C# 类似PS的魔棒工具漫水加边缘获取
- C#生成PDF 读取PDF文本内容 获取PDF内图
- C#获取视频时长,并且视频截图
- C# 获取MAC地址 硬盘ID IE火狐谷歌 带
- WinForm窗体程序中使用CefSharp获取加载
- 获取鼠标所在窗口的句柄、类名c#
- C#通过窗口名获取程序所有控件句柄
- C#获取视频某一帧的缩略图的方法
- 小程序获取openid(亲测通过)
- vb.net 获取USB 摄像头 图像 Aforge方法
- 不获取焦点的虚拟键盘-Winform
- WPF写的获取外部公网IP地址及发送邮件
- C#获取usb设备VID和PID
评论
共有 条评论