Guest User

Untitled

a guest
Dec 10th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. public abstract class add_components
  2. {
  3. public abstract void add_dynamic_components(int noOfComponets, int locationX, int locationY, Form1 l, int currentTabIndex);
  4. }
  5.  
  6. public class addDynamicCptboxComponents : add_components
  7. {
  8. public override void add_dynamic_components(int getNoOfTxtBox, int pointX, int pointY, Form1 f, int currentTabIndex)
  9. {
  10. TextBox txtBox = new TextBox();
  11. f.panel1.Controls.Add(txtBox);
  12. txtBox.Location = new Point(pointX, pointY);
  13. txtBox.Size = new System.Drawing.Size(75, 23);
  14. f.panel1.Controls.Add(txtBox);
  15. txtBox.Name = "Add_txtBox" + getNoOfTxtBox;
  16. txtBox.TabIndex = currentTabIndex * 7 + 2;
  17. }
  18. }
  19.  
  20. public class addDynamicDateofServiceComponents : add_components
  21. {
  22.  
  23. public override void add_dynamic_components(int getNoOfTxtBox, int pointX, int pointY, Form1 f, int currentTabIndex)
  24. {
  25. TextBox txtBox = new TextBox();
  26. f.panel1.Controls.Add(txtBox);
  27. txtBox.Location = new Point(pointX, pointY);
  28. txtBox.Size = new System.Drawing.Size(75, 23);
  29. f.panel1.Controls.Add(txtBox);
  30. txtBox.Name = "Add_dos_txtBox" + getNoOfTxtBox;
  31. txtBox.TabIndex = currentTabIndex * 7 + 1;
  32. }
  33. }
  34. public class addDynamicSpellboxComponents : add_components
  35. {
  36.  
  37. public override void add_dynamic_components(int getNoOfSpellTxtBox, int spPointX, int spPointY, Form1 f, int currentTabIndex)
  38. {
  39. RichTextBox sp = new RichTextBox();
  40. f.panel1.Controls.Add(sp);
  41. sp.Location = new Point(spPointX, spPointY);
  42. sp.Size = new System.Drawing.Size(230, 43);
  43. f.panel1.Controls.Add(sp);
  44. sp.Name = "RichTextbox" + getNoOfSpellTxtBox;
  45. sp.TabIndex = currentTabIndex * 7 + 3;
  46.  
  47. }
  48. }
  49.  
  50. public partial class Form1 : Form
  51. {
  52. addDynamicCptboxComponents addcomponent = new addDynamicCptboxComponents();
  53. addDynamicSpellboxComponents addSpellboxComponent = new addDynamicSpellboxComponents();
  54. addDynamicDateofServiceComponents adddoscomponents = new addDynamicDateofServiceComponents();
  55.  
  56. public Form1()
  57. {
  58. try
  59. {
  60. InitializeComponent();
  61. }
  62. catch (Exception ex)
  63. {
  64. //Write ex.Message to a file
  65. using (StreamWriter outfile = new StreamWriter(@".error.txt"))
  66. {
  67. outfile.Write(ex.Message.ToString());
  68. }
  69. }
  70. initalizeUserdefinedComponents();
  71.  
  72. }
  73.  
  74. public void createDynamiccomponents()
  75. {
  76. int padding = 24;
  77. int gap = 50;
  78. int value;
  79. if (int.TryParse(txtboxvalLines.Text, out value))
  80. {
  81. int txtno = int.Parse(txtboxvalLines.Text);
  82. int pointX = 125;
  83. int pointY = padding ;
  84. int spPointX = 240;
  85. int spPointY = padding ;
  86. int txtboxRecommendedpointX = 640;
  87. int txtboxRecommendedpointY = padding ;
  88. int btnPointX = 1170;
  89. int btnPointY = padding ;
  90. int cmbPointX = 520;
  91. int cmbPointY = padding ;
  92. int pncPointX = 920;
  93. int pncPointY = padding ;
  94. int finalcmbPointX = 780;
  95. int finalcmbPointY = padding ;
  96. int DOSPointX = 35;
  97. int DOSPointY = padding ;
  98.  
  99. for (int i = 0; i < txtno; i++)
  100. {
  101. customize_panel();
  102.  
  103. addcomponent.add_dynamic_components(i, pointX, pointY, this, i);
  104. addSpellboxComponent.add_dynamic_components(i, spPointX, spPointY, this, i);
  105.  
  106. adddoscomponents.add_dynamic_components(i, DOSPointX, DOSPointY, this, i);
  107. panel1.Show();
  108. spPointY += gap;
  109. btnPointY += gap;
  110. cmbPointY += gap;
  111. pointY += gap;
  112. pncPointY += gap;
  113. txtboxRecommendedpointY += gap;
  114. finalcmbPointY += gap;
  115. DOSPointY += gap;
  116. }
  117.  
  118. btnAdd.Enabled = false;
  119. txtboxvalLines.Enabled = false;
  120. panel1.Focus();
  121. }
  122. else
  123. {
  124. MessageBox.Show("Please provide the count of total Claim lines");
  125. txtboxvalLines.Text = "";
  126. }
  127. }
  128. }
Add Comment
Please, Sign In to add comment