資源簡介
能夠實時獲取股票數據
代碼片段和文件信息
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?????????????{
????????????????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?????????????????????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固定資產管理系統源碼
評論
共有 條評論