Guest User

Untitled

a guest
Mar 21st, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6.  
  7. namespace WindowsFormsApplication4
  8. {
  9. static class Program
  10. {
  11. /// <summary>
  12. /// The main entry point for the application.
  13. /// </summary>
  14. [STAThread]
  15. static void Main()
  16. {
  17. Application.EnableVisualStyles();
  18. Application.SetCompatibleTextRenderingDefault(false);
  19. Application.Run(new prod_line());
  20. }
  21. }
  22. }
  23.  
  24. namespace WindowsFormsApplication4
  25. {
  26. partial class prod_line
  27. {
  28. /// <summary>
  29. /// Required designer variable.
  30. /// </summary>
  31. private System.ComponentModel.IContainer components = null;
  32.  
  33.  
  34. /// <summary>
  35. /// Clean up any resources being used.
  36. /// </summary>
  37. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  38. protected override void Dispose(bool disposing)
  39. {
  40. if (disposing && (components != null))
  41. {
  42. components.Dispose();
  43. }
  44. base.Dispose(disposing);
  45. }
  46.  
  47. #region Windows Form Designer generated code
  48.  
  49. /// <summary>
  50. /// Required method for Designer support - do not modify
  51. /// the contents of this method with the code editor.
  52. /// </summary>
  53. private void InitializeComponent()
  54. {
  55. this.radioButton1 = new System.Windows.Forms.RadioButton();
  56. this.radioButton2 = new System.Windows.Forms.RadioButton();
  57. this.radioButton3 = new System.Windows.Forms.RadioButton();
  58. this.label1 = new System.Windows.Forms.Label();
  59. this.button1 = new System.Windows.Forms.Button();
  60. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  61. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
  62. this.SuspendLayout();
  63. //
  64. // radioButton1
  65. //
  66. this.radioButton1.AutoSize = true;
  67. this.radioButton1.Font = new System.Drawing.Font("Perpetua Titling MT", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  68. this.radioButton1.Location = new System.Drawing.Point(175, 182);
  69. this.radioButton1.Name = "radioButton1";
  70. this.radioButton1.Size = new System.Drawing.Size(58, 20);
  71. this.radioButton1.TabIndex = 0;
  72. this.radioButton1.TabStop = true;
  73. this.radioButton1.Text = "PL3E";
  74. this.radioButton1.UseVisualStyleBackColor = true;
  75. this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
  76. //
  77. // radioButton2
  78. //
  79. this.radioButton2.AutoSize = true;
  80. this.radioButton2.Font = new System.Drawing.Font("Perpetua Titling MT", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  81. this.radioButton2.Location = new System.Drawing.Point(172, 240);
  82. this.radioButton2.Name = "radioButton2";
  83. this.radioButton2.Size = new System.Drawing.Size(61, 20);
  84. this.radioButton2.TabIndex = 1;
  85. this.radioButton2.TabStop = true;
  86. this.radioButton2.Text = "PL24";
  87. this.radioButton2.UseVisualStyleBackColor = true;
  88. //
  89. // radioButton3
  90. //
  91. this.radioButton3.AutoSize = true;
  92. this.radioButton3.Font = new System.Drawing.Font("Perpetua Titling MT", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  93. this.radioButton3.Location = new System.Drawing.Point(175, 298);
  94. this.radioButton3.Name = "radioButton3";
  95. this.radioButton3.Size = new System.Drawing.Size(59, 20);
  96. this.radioButton3.TabIndex = 2;
  97. this.radioButton3.TabStop = true;
  98. this.radioButton3.Text = "PL25";
  99. this.radioButton3.UseVisualStyleBackColor = true;
  100. //
  101. // label1
  102. //
  103. this.label1.AutoSize = true;
  104. this.label1.Font = new System.Drawing.Font("Palatino Linotype", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  105. this.label1.Location = new System.Drawing.Point(111, 132);
  106. this.label1.Name = "label1";
  107. this.label1.Size = new System.Drawing.Size(205, 27);
  108. this.label1.TabIndex = 4;
  109. this.label1.Text = "PRODUCTION LINE";
  110. //
  111. // button1
  112. //
  113. this.button1.Font = new System.Drawing.Font("Perpetua Titling MT", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  114. this.button1.Location = new System.Drawing.Point(257, 374);
  115. this.button1.Name = "button1";
  116. this.button1.Size = new System.Drawing.Size(75, 23);
  117. this.button1.TabIndex = 5;
  118. this.button1.Text = "OK";
  119. this.button1.UseVisualStyleBackColor = true;
  120. this.button1.Click += new System.EventHandler(this.button1_Click);
  121. //
  122. // pictureBox1
  123. //
  124. this.pictureBox1.Image = global::WindowsFormsApplication4.Properties.Resources.Keysight_Signature_Pref_Color;
  125. this.pictureBox1.Location = new System.Drawing.Point(143, 40);
  126. this.pictureBox1.Name = "pictureBox1";
  127. this.pictureBox1.Size = new System.Drawing.Size(139, 73);
  128. this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  129. this.pictureBox1.TabIndex = 6;
  130. this.pictureBox1.TabStop = false;
  131. //
  132. // prod_line
  133. //
  134. this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
  135. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  136. this.ClientSize = new System.Drawing.Size(419, 478);
  137. this.Controls.Add(this.pictureBox1);
  138. this.Controls.Add(this.button1);
  139. this.Controls.Add(this.label1);
  140. this.Controls.Add(this.radioButton3);
  141. this.Controls.Add(this.radioButton2);
  142. this.Controls.Add(this.radioButton1);
  143. this.Name = "prod_line";
  144. this.Text = "prod_line";
  145. this.Load += new System.EventHandler(this.prod_line_Load);
  146. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
  147. this.ResumeLayout(false);
  148. this.PerformLayout();
  149.  
  150. }
  151.  
  152. #endregion
  153.  
  154. private System.Windows.Forms.RadioButton radioButton1;
  155. private System.Windows.Forms.RadioButton radioButton2;
  156. private System.Windows.Forms.RadioButton radioButton3;
  157. // private System.Windows.Forms.PictureBox pictureBox1;
  158. private System.Windows.Forms.Label label1;
  159. private System.Windows.Forms.Button button1;
  160. private System.Windows.Forms.PictureBox pictureBox1;
  161.  
  162. }
  163. }
  164.  
  165. using System;
  166. using System.Collections.Generic;
  167. using System.ComponentModel;
  168. using System.Data;
  169. using System.Drawing;
  170. using System.Linq;
  171. using System.Text;
  172. using System.Threading.Tasks;
  173. using System.Windows.Forms;
  174. using MySql.Data.MySqlClient;
  175.  
  176. namespace WindowsFormsApplication4
  177. {
  178. public partial class prod_line : Form
  179. {
  180. TesterList test = new TesterList();
  181. public prod_line()
  182. {
  183. InitializeComponent();
  184.  
  185. }
  186.  
  187. private void prod_line_Load(object sender, EventArgs e)
  188. {
  189. radioButton1.Checked = true;
  190. }
  191.  
  192. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  193. {
  194. try
  195. {
  196. MySqlConnection connection = new MySqlConnection("Datasource=localhost;port=3306;username=root;password=");
  197.  
  198. string selectQuery = "SELECT * FROM keysight.tester where prod_id = 1";
  199. connection.Open();
  200. MySqlCommand command = new MySqlCommand(selectQuery, connection);
  201. MySqlDataReader reader = command.ExecuteReader();
  202. while (reader.Read())
  203. {
  204. comboBox1.Items.Add(reader.GetString("test_name"));
  205. }
  206. }
  207. catch (Exception ex)
  208. {
  209. MessageBox.Show(ex.Message);
  210. }
  211. }
  212.  
  213. private void button1_Click(object sender, EventArgs e)
  214. {
  215. if (radioButton1.Checked == true)
  216. {
  217.  
  218. TesterList obj = new TesterList();
  219. if (obj == null)
  220. {
  221. obj.Parent = this;
  222. }
  223. obj.Show();
  224. this.Hide();
  225.  
  226.  
  227.  
  228. }
  229. }
  230. }
  231. }
  232.  
  233. namespace WindowsFormsApplication4
  234. {
  235. partial class TesterList
  236. {
  237. /// <summary>
  238. /// Required designer variable.
  239. /// </summary>
  240. private System.ComponentModel.IContainer components = null;
  241.  
  242. /// <summary>
  243. /// Clean up any resources being used.
  244. /// </summary>
  245. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  246. protected override void Dispose(bool disposing)
  247. {
  248. if (disposing && (components != null))
  249. {
  250. components.Dispose();
  251. }
  252. base.Dispose(disposing);
  253. }
  254.  
  255. #region Windows Form Designer generated code
  256.  
  257. /// <summary>
  258. /// Required method for Designer support - do not modify
  259. /// the contents of this method with the code editor.
  260. /// </summary>
  261. private void InitializeComponent()
  262. {
  263. this.comboBox1 = new System.Windows.Forms.ComboBox();
  264. this.button1 = new System.Windows.Forms.Button();
  265. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  266. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
  267. this.SuspendLayout();
  268. //
  269. // comboBox1
  270. //
  271. this.comboBox1.FormattingEnabled = true;
  272. this.comboBox1.Location = new System.Drawing.Point(121, 192);
  273. this.comboBox1.Name = "comboBox1";
  274. this.comboBox1.Size = new System.Drawing.Size(237, 24);
  275. this.comboBox1.TabIndex = 0;
  276. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  277. //
  278. // button1
  279. //
  280. this.button1.Location = new System.Drawing.Point(283, 305);
  281. this.button1.Name = "button1";
  282. this.button1.Size = new System.Drawing.Size(75, 23);
  283. this.button1.TabIndex = 1;
  284. this.button1.Text = "OK";
  285. this.button1.UseVisualStyleBackColor = true;
  286. //
  287. // pictureBox1
  288. //
  289. this.pictureBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
  290. this.pictureBox1.Image = global::WindowsFormsApplication4.Properties.Resources.Keysight_Signature_Pref_Color;
  291. this.pictureBox1.Location = new System.Drawing.Point(153, 51);
  292. this.pictureBox1.Name = "pictureBox1";
  293. this.pictureBox1.Size = new System.Drawing.Size(174, 100);
  294. this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  295. this.pictureBox1.TabIndex = 8;
  296. this.pictureBox1.TabStop = false;
  297. //
  298. // TesterList
  299. //
  300. this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
  301. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  302. this.ClientSize = new System.Drawing.Size(472, 489);
  303. this.Controls.Add(this.pictureBox1);
  304. this.Controls.Add(this.button1);
  305. this.Controls.Add(this.comboBox1);
  306. this.Name = "TesterList";
  307. this.Text = "TesterList";
  308. this.Load += new System.EventHandler(this.TesterList_Load);
  309. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
  310. this.ResumeLayout(false);
  311.  
  312. }
  313.  
  314. #endregion
  315.  
  316. private System.Windows.Forms.ComboBox comboBox1;
  317. private System.Windows.Forms.Button button1;
  318. //private System.Windows.Forms.RadioButton radioButton1;
  319.  
  320. private System.Windows.Forms.PictureBox pictureBox1;
  321.  
  322. }
  323. }
  324.  
  325. using System;
  326. using System.Collections.Generic;
  327. using System.ComponentModel;
  328. using System.Data;
  329. using System.Drawing;
  330. using System.Linq;
  331. using System.Text;
  332. using System.Threading.Tasks;
  333. using System.Windows.Forms;
  334. using MySql.Data.MySqlClient;
  335. namespace WindowsFormsApplication4
  336. {
  337. public partial class TesterList : Form
  338. {
  339. prod_line p = new prod_line();
  340. public TesterList()
  341. {
  342. InitializeComponent();
  343. }
  344.  
  345. private void TesterList_Load(object sender, EventArgs e)
  346. {
  347. if (radioButton1.Checked == true)
  348. {
  349. try
  350. {
  351. MySqlConnection connection = new MySqlConnection("Datasource=localhost;port=3306;username=root;password=");
  352.  
  353. string selectQuery = "SELECT * FROM keysight.tester where prod_id = 1";
  354. connection.Open();
  355. MySqlCommand command = new MySqlCommand(selectQuery, connection);
  356. MySqlDataReader reader = command.ExecuteReader();
  357. while (reader.Read())
  358. {
  359. comboBox1.Items.Add(reader.GetString("test_name"));
  360. }
  361. }
  362. catch (Exception ex)
  363. {
  364. MessageBox.Show(ex.Message);
  365. }
  366. }
  367. }
  368.  
  369. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  370. {
  371.  
  372. }
  373. }
Add Comment
Please, Sign In to add comment