mirror of
https://github.com/ClassicDIY/ModbusTool.git
synced 2026-10-26 02:19:31 +08:00
Generated
+1
-1
@@ -74,7 +74,7 @@
|
||||
// txtSize
|
||||
//
|
||||
this.txtSize.Location = new System.Drawing.Point(211, 16);
|
||||
this.txtSize.MaxLength = 3;
|
||||
this.txtSize.MaxLength = 5;
|
||||
this.txtSize.Name = "txtSize";
|
||||
this.txtSize.Size = new System.Drawing.Size(40, 20);
|
||||
this.txtSize.TabIndex = 34;
|
||||
|
||||
@@ -56,12 +56,13 @@ namespace Modbus.Common
|
||||
ushort rVal = 64;
|
||||
try
|
||||
{
|
||||
if (txtSize.Text.IndexOf("0x", 0, txtSize.Text.Length) == 0)
|
||||
if (txtSize.Text.StartsWith("0x", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
string str = txtSize.Text.Replace("0x", "");
|
||||
rVal = Convert.ToUInt16(str, 16);
|
||||
}
|
||||
rVal = Convert.ToUInt16(txtSize.Text);
|
||||
else
|
||||
rVal = Convert.ToUInt16(txtSize.Text);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -71,7 +72,13 @@ namespace Modbus.Common
|
||||
}
|
||||
set
|
||||
{
|
||||
txtSize.Text = Convert.ToString(value);
|
||||
if (txtSize.Text.StartsWith("0x", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
// obey hex input
|
||||
txtSize.Text = "0x"+Convert.ToString(value, 16);
|
||||
}
|
||||
else
|
||||
txtSize.Text = Convert.ToString(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user