Advertisement
Guest User

asdf

a guest
Apr 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. Public Class PartsForm
  2. Public numbers() As String = {"3827", "2871", "8671", "5986"}
  3. Public price() As Double = {36.74, 3.21, 17.93, 9.21}
  4. Public description() As String = {"Motor", "Switch", "Wire Harness", "Bearing"}
  5. Public index As Integer
  6. Private Sub PartsForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  7. numberTextBox.Text = numbers(0)
  8. priceTextBox.Text = price(0)
  9. descriptionTextBox.Text = description(0)
  10. End Sub
  11.  
  12. Private Sub Switch(ByVal add As Boolean, ByVal edit As Boolean, ByVal update As Boolean, ByVal cancel As Boolean)
  13. If add = True Then
  14. addButton.Enabled = False
  15. editButton.Enabled = False
  16. deleteButton.Enabled = False
  17. previousButton.Enabled = False
  18. nextButton.Enabled = False
  19. updateButton.Enabled = True
  20. cancelProcessButton.Enabled = True
  21. numberTextBox.ReadOnly = False
  22. priceTextBox.ReadOnly = False
  23. descriptionTextBox.ReadOnly = False
  24. numberTextBox.Focus()
  25. numberTextBox.Text = ""
  26. priceTextBox.Text = ""
  27. descriptionTextBox.Text = ""
  28. ElseIf edit = True Then
  29. addButton.Enabled = False
  30. editButton.Enabled = False
  31. deleteButton.Enabled = False
  32. previousButton.Enabled = False
  33. nextButton.Enabled = False
  34. updateButton.Enabled = True
  35. cancelProcessButton.Enabled = True
  36. numberTextBox.Text = numbers(0)
  37. priceTextBox.Text = price(0)
  38. descriptionTextBox.Text = description(0)
  39. numberTextBox.ReadOnly = False
  40. priceTextBox.ReadOnly = False
  41. descriptionTextBox.ReadOnly = False
  42. numberTextBox.Focus()
  43. ElseIf update = True Then
  44. addButton.Enabled = True
  45. editButton.Enabled = True
  46. deleteButton.Enabled = True
  47. previousButton.Enabled = True
  48. nextButton.Enabled = True
  49. updateButton.Enabled = False
  50. cancelProcessButton.Enabled = False
  51. numberTextBox.ReadOnly = True
  52. priceTextBox.ReadOnly = True
  53. descriptionTextBox.ReadOnly = True
  54.  
  55. For i As Integer = 0 To numbers.Length - 1
  56. numbers(i) = numberTextBox.Text
  57. Exit Sub
  58. Next
  59. For i As Integer = 0 To description.Length - 1
  60. description(i) = descriptionTextBox.Text
  61. Next
  62. For i As Integer = 0 To price.Length - 1
  63. price(i) = priceTextBox.Text
  64. Next
  65.  
  66. ElseIf cancel = True Then
  67. addButton.Enabled = True
  68. editButton.Enabled = True
  69. deleteButton.Enabled = True
  70. previousButton.Enabled = True
  71. nextButton.Enabled = True
  72. updateButton.Enabled = False
  73. cancelProcessButton.Enabled = False
  74. numberTextBox.ReadOnly = True
  75. priceTextBox.ReadOnly = True
  76. descriptionTextBox.ReadOnly = True
  77. numberTextBox.Text = numbers(0)
  78. priceTextBox.Text = price(0)
  79. descriptionTextBox.Text = description(0)
  80. End If
  81. End Sub
  82.  
  83. Private Sub addButton_Click(sender As Object, e As EventArgs) Handles addButton.Click
  84. Switch(1, 0, 0, 0)
  85.  
  86. End Sub
  87.  
  88. Private Sub editButton_Click(sender As Object, e As EventArgs) Handles editButton.Click
  89. Switch(0, 1, 0, 0)
  90. End Sub
  91.  
  92. Private Sub updateButton_Click(sender As Object, e As EventArgs) Handles updateButton.Click
  93. Switch(0, 0, 1, 0)
  94. End Sub
  95.  
  96. Private Sub cancelProcessButton_Click(sender As Object, e As EventArgs) Handles cancelProcessButton.Click
  97. Switch(0, 0, 0, 1)
  98. End Sub
  99. Private Sub Display(ByVal nextClick As Boolean, ByVal prevClick As Boolean)
  100. If nextClick = True Then
  101. index += 1
  102. If index <= 3 Then
  103. numberTextBox.Text = numbers(index)
  104. priceTextBox.Text = price(index)
  105. descriptionTextBox.Text = description(index)
  106. End If
  107. ElseIf index > 3 Then
  108. index -= 1
  109. If prevClick = True Then
  110. numberTextBox.Text = numbers(index)
  111. priceTextBox.Text = price(index)
  112. descriptionTextBox.Text = description(index)
  113. ElseIf index < 3 Then
  114. index += 1
  115. End If
  116.  
  117. End If
  118. If prevClick = True Then
  119. index -= 1
  120. If index >= 0 Then
  121. numberTextBox.Text = numbers(index)
  122. priceTextBox.Text = price(index)
  123. descriptionTextBox.Text = description(index)
  124. End If
  125. ElseIf index < 0 Or index > 3 Then
  126.  
  127.  
  128. End If
  129. End Sub
  130.  
  131. Private Sub nextButton_Click(sender As Object, e As EventArgs) Handles nextButton.Click
  132. Display(1, 0)
  133. End Sub
  134.  
  135. Private Sub previousButton_Click(sender As Object, e As EventArgs) Handles previousButton.Click
  136. Display(0, 1)
  137. End Sub
  138. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement