91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 57KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2024-01-21
  • 語言: C#
  • 標簽:

資源簡介

c#編寫的簡單抄電表軟件,有很詳細的注釋,對初學者很有幫助

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Data.SqlClient;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Text.Regularexpressions;
using?System.Windows.Forms;
using?System.IO;
using?System.IO.Ports;

namespace?抄表軟件
{
????public?partial?class?Form1?:?Form
????{
????????static?SerialPort?com;
????????public?byte[]?dizhi?=?new?byte[6];?//?用來保存表內通信地址?
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????com?=?new?SerialPort();

????????????//?初始化串口組合框
????????????combox.Items.Clear();
????????????foreach?(string?s?in?SerialPort.GetPortNames())
????????????{
????????????????combox.Items.Add(s.Trim());
????????????}

????????????if?(0?==?combox.Items.Count)
????????????{?MessageBox.Show(“當前沒有可用的串口!“);
??????????????
????????????}

????????????//?初始化波特率組合框
????????????baudratebox.Items.Clear();
????????????baudratebox.Items.AddRange(new?object[]?{?600?1200?2400?4800?9600?19200?});
????????????

???????????
????????}
????private?void?dutongxun_Click(object?sender?EventArgs?e)
????????{
????????????byte[]?inputAddr?=?new?byte[6];?//?用來保存原先通信地址

????????????#region?設置并打開串口
????????????//?根據協議對串口進行設置
????????????com.PortName?=?SetPortName(com.PortName);???????//?串口名由用戶自己選擇
????????????com.BaudRate?=?SetPortBaudRate(com.BaudRate);???//?波特率由用戶自己選擇
????????????com.Parity?=?Parity.Even;???????????????????????????????//?偶校驗
????????????com.DataBits?=?8;???????????????????????????????????????//?8位數據位
????????????com.StopBits?=?StopBits.One;????????????????????????????//?1位停止位
????????????com.Handshake?=?Handshake.None;

????????????//?設置讀/寫延時
????????????com.ReadTimeout?=?500;
????????????com.WriteTimeout?=?500;
????????????try
????????????{
????????????????com.Open();
????????????}
????????????#region?catch塊
????????????catch?(InvalidOperationException)
????????????{
????????????????MessageBox.Show(“通訊失敗!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????return;
????????????}
????????????catch?(ArgumentOutOfRangeException)
????????????{
????????????????MessageBox.Show(“通訊失敗!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????return;
????????????}
????????????catch?(ArgumentException)
????????????{
????????????????MessageBox.Show(“通訊失敗!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????return;
????????????}
????????????catch?(IOException)
????????????{
????????????????MessageBox.Show(“通訊失敗!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????return;
????????????}
????????????catch?(UnauthorizedAccessException)
????????????{
????????????????MessageBox.Show(“通訊失敗!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????return;
????????????}
????????????#endregion

?????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????5612??2011-12-09?14:04??抄表軟件\抄表軟件\Properties\Resources.resx

?????文件????????249??2011-12-09?14:04??抄表軟件\抄表軟件\Properties\Settings.settings

?????文件???????1380??2011-12-09?14:04??抄表軟件\抄表軟件\Properties\AssemblyInfo.cs

?????文件???????2874??2011-12-09?14:04??抄表軟件\抄表軟件\Properties\Resources.Designer.cs

?????文件???????1097??2011-12-09?14:04??抄表軟件\抄表軟件\Properties\Settings.Designer.cs

?????文件???????5814??2011-12-13?13:49??抄表軟件\抄表軟件\Form1.resx

?????文件??????52947??2011-12-13?14:25??抄表軟件\抄表軟件\Form1.cs

?????文件???????3770??2011-12-09?14:08??抄表軟件\抄表軟件\抄表軟件.csproj

?????文件????????490??2007-07-21?01:33??抄表軟件\抄表軟件\bin\Debug\抄表軟件.vshost.exe.manifest

?????文件??????14328??2011-12-13?14:33??抄表軟件\抄表軟件\bin\Debug\抄表軟件.vshost.exe

?????文件??????24064??2011-12-13?14:25??抄表軟件\抄表軟件\bin\Debug\抄表軟件.exe

?????文件??????46592??2011-12-13?14:25??抄表軟件\抄表軟件\bin\Debug\抄表軟件.pdb

?????文件????????180??2011-12-13?13:49??抄表軟件\抄表軟件\obj\Debug\抄表軟件.Form1.resources

?????文件????????180??2011-12-09?14:08??抄表軟件\抄表軟件\obj\Debug\抄表軟件.Properties.Resources.resources

?????文件??????24064??2011-12-13?14:25??抄表軟件\抄表軟件\obj\Debug\抄表軟件.exe

?????文件????????887??2011-12-13?14:33??抄表軟件\抄表軟件\obj\Debug\抄表軟件.csproj.FileListAbsolute.txt

?????文件??????46592??2011-12-13?14:25??抄表軟件\抄表軟件\obj\Debug\抄表軟件.pdb

?????文件????????847??2011-12-13?13:49??抄表軟件\抄表軟件\obj\Debug\抄表軟件.csproj.GenerateResource.Cache

?????文件??????13687??2011-12-13?13:49??抄表軟件\抄表軟件\Form1.Designer.cs

?????文件????????493??2011-12-09?14:04??抄表軟件\抄表軟件\Program.cs

?????文件????????926??2011-12-09?14:04??抄表軟件\抄表軟件.sln

????..A..H.?????14848??2011-12-13?14:42??抄表軟件\抄表軟件.suo

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件\obj\Debug\TempPE

?????目錄??????????0??2011-12-09?15:13??抄表軟件\抄表軟件\obj\Debug\Refactor

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件\bin\Debug

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件\obj\Debug

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件\Properties

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件\bin

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件\obj

?????目錄??????????0??2011-12-09?14:04??抄表軟件\抄表軟件

............此處省略4個文件信息

評論

共有 條評論

相關資源