From d7c8c7c50777026e61b221528cd93f929e8e51ec Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期四, 06 十一月 2025 17:38:20 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/XtraForm1.Designer.cs |   32 +++++++++++-----
 DevApp/Gs.DevApp/ToolBox/MsgHelper.cs  |    1 
 DevApp/Gs.DevApp/XtraForm1.cs          |   31 +++++++++++++++
 3 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/DevApp/Gs.DevApp/ToolBox/MsgHelper.cs b/DevApp/Gs.DevApp/ToolBox/MsgHelper.cs
index 4300e16..0cd3733 100644
--- a/DevApp/Gs.DevApp/ToolBox/MsgHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/MsgHelper.cs
@@ -49,7 +49,6 @@
                 innerMsg = e.InnerException.Message;
                 s += "\n" + innerMsg;
             }
-
             Warning(s);
         }
 
diff --git a/DevApp/Gs.DevApp/XtraForm1.Designer.cs b/DevApp/Gs.DevApp/XtraForm1.Designer.cs
index 920bc7e..baa9b9b 100644
--- a/DevApp/Gs.DevApp/XtraForm1.Designer.cs
+++ b/DevApp/Gs.DevApp/XtraForm1.Designer.cs
@@ -35,11 +35,12 @@
             this.label1 = new System.Windows.Forms.Label();
             this.txt_slaveAddress = new DevExpress.XtraEditors.ComboBoxEdit();
             this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
+            this.button1 = new System.Windows.Forms.Button();
             this.btnEdit = new DevExpress.XtraEditors.ButtonEdit();
             this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
             this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
             this.txtGWM = new DevExpress.XtraEditors.TextEdit();
-            this.button1 = new System.Windows.Forms.Button();
+            this.simpleButton3 = new DevExpress.XtraEditors.SimpleButton();
             ((System.ComponentModel.ISupportInitialize)(this.txtGs.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txt_slaveAddress.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
@@ -50,7 +51,7 @@
             // 
             // simpleButton2
             // 
-            this.simpleButton2.Location = new System.Drawing.Point(447, 29);
+            this.simpleButton2.Location = new System.Drawing.Point(396, 49);
             this.simpleButton2.Name = "simpleButton2";
             this.simpleButton2.Size = new System.Drawing.Size(201, 29);
             this.simpleButton2.TabIndex = 1;
@@ -114,6 +115,7 @@
             // 
             // panelControl1
             // 
+            this.panelControl1.Controls.Add(this.simpleButton3);
             this.panelControl1.Controls.Add(this.button1);
             this.panelControl1.Controls.Add(this.btnEdit);
             this.panelControl1.Controls.Add(this.simpleButton1);
@@ -129,6 +131,16 @@
             this.panelControl1.Name = "panelControl1";
             this.panelControl1.Size = new System.Drawing.Size(887, 120);
             this.panelControl1.TabIndex = 7;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(699, 29);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 11;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
             // btnEdit
             // 
@@ -164,15 +176,14 @@
             this.txtGWM.Size = new System.Drawing.Size(183, 24);
             this.txtGWM.TabIndex = 7;
             // 
-            // button1
+            // simpleButton3
             // 
-            this.button1.Location = new System.Drawing.Point(699, 29);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(75, 23);
-            this.button1.TabIndex = 11;
-            this.button1.Text = "button1";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
+            this.simpleButton3.Location = new System.Drawing.Point(475, 6);
+            this.simpleButton3.Name = "simpleButton3";
+            this.simpleButton3.Size = new System.Drawing.Size(94, 29);
+            this.simpleButton3.TabIndex = 12;
+            this.simpleButton3.Text = "simpleButton3";
+            this.simpleButton3.Click += new System.EventHandler(this.simpleButton3_Click);
             // 
             // XtraForm1
             // 
@@ -207,5 +218,6 @@
         private DevExpress.XtraEditors.SimpleButton simpleButton1;
         private DevExpress.XtraEditors.ButtonEdit btnEdit;
         private System.Windows.Forms.Button button1;
+        private DevExpress.XtraEditors.SimpleButton simpleButton3;
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/XtraForm1.cs b/DevApp/Gs.DevApp/XtraForm1.cs
index 7ecc96b..77292b8 100644
--- a/DevApp/Gs.DevApp/XtraForm1.cs
+++ b/DevApp/Gs.DevApp/XtraForm1.cs
@@ -324,5 +324,36 @@
             }
             richTextBox1.Text = sbLine.ToString();
         }
+
+        private void simpleButton3_Click(object sender, EventArgs e)
+        {
+            string ddd = "1";
+            try
+            {
+                if (IsValidDate(ddd, "鏃ユ湡"))
+                    MessageBox.Show("姝e父");
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+          
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鏄惁涓烘棩鏈�
+        /// </summary>
+        /// <param name="dateString"></param>
+        /// <returns></returns>
+        public  bool IsValidDate(string dateString, string ziDuan = "")
+        {
+            bool bl = DateTime.TryParse(dateString, out _);
+            if (bl == true)
+                return bl;
+            if (string.IsNullOrEmpty(ziDuan))
+                return bl;
+            throw new Exception(ziDuan + "涓嶆槸鍚堟硶鐨勬棩鏈熺被鍨嬶紒");
+        }
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3