added conditions for thickness, bug with some choices where options are empty

This commit is contained in:
Mans 2021-02-08 14:11:07 +01:00
parent 4283e09c79
commit 83c3984c65
3 changed files with 45 additions and 7 deletions

Binary file not shown.

View File

@ -2,8 +2,8 @@
Imports Excel = Microsoft.Office.Interop.Excel
Public Class GUI
Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
'Public Shared filepath As String = "C:\Users\xperd\Documents"
'Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
Public Shared filepath As String = "C:\Users\xperd\Documents"
Dim excelApp As Excel.Application = New Excel.Application
Dim excelWB As Excel.Workbook

View File

@ -217,11 +217,49 @@
GUI.ComboBox_Thickness.Items.Clear()
gratingHeight = CInt(GUI.ComboBox_Height.Text)
' Add thicknesses
If gratingHeight = 20 Then
GUI.ComboBox_Thickness.Items.Add("2")
GUI.ComboBox_Thickness.Items.Add("3")
End If
Dim meshesDT As DataTable = GUI.dataBase("Meshes")
Dim nameInDT As String = meshesDT.Rows(0)("NAME")
Dim materialInDT As String = meshesDT.Rows(0)("MATERIAL")
Dim serratedInDT As Boolean = CBool(meshesDT.Rows(0)("SERRATED"))
Dim LBSpacingInDT As Integer = CInt(meshesDT.Rows(0)("LB-SPACING"))
Dim CBSpacingInDT As Integer = CInt(meshesDT.Rows(0)("CB-SPACING"))
Dim HeightInDT As Integer = CInt(meshesDT.Rows(0)("LB-HEIGHT"))
Dim tempList As New List(Of Integer)
For i = 0 To meshesDT.Rows.Count - 1
If gratingName = nameInDT AndAlso loadBarSpacing = LBSpacingInDT AndAlso crossBarSpacing = CBSpacingInDT _
AndAlso gratingSerrated = serratedInDT AndAlso gratingMaterial = materialInDT AndAlso gratingHeight = HeightInDT Then
Dim addItem As Boolean = True
For j = 0 To tempList.Count - 1
If meshesDT.Rows(i)("LB-THICKNESS") = tempList(j) Then
addItem = False
Exit For
End If
Next
If addItem = True Then
tempList.Add(CInt(meshesDT.Rows(i)("LB-THICKNESS")))
End If
End If
Try
nameInDT = meshesDT.Rows(i + 1)("NAME")
materialInDT = meshesDT.Rows(i + 1)("MATERIAL")
serratedInDT = CBool(meshesDT.Rows(i + 1)("SERRATED"))
LBSpacingInDT = CInt(meshesDT.Rows(i + 1)("LB-SPACING"))
CBSpacingInDT = CInt(meshesDT.Rows(i + 1)("CB-SPACING"))
HeightInDT = CInt(meshesDT.Rows(i + 1)("LB-HEIGHT"))
Catch ex As Exception
End Try
Next
tempList.Sort()
For i = 0 To tempList.Count - 2
GUI.ComboBox_Thickness.Items.Add(tempList(i))
Next
End Sub
Public Shared Sub ThicknessChanged(sender As Object, e As EventArgs)