diff --git a/Databas.xlsx b/Databas.xlsx index b5c2374..f9da423 100644 Binary files a/Databas.xlsx and b/Databas.xlsx differ diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index b871be2..3c3a5e4 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -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 diff --git a/Wardrobe/GUI_Gratings_Data.vb b/Wardrobe/GUI_Gratings_Data.vb index 8c786e8..ebbd8c9 100644 --- a/Wardrobe/GUI_Gratings_Data.vb +++ b/Wardrobe/GUI_Gratings_Data.vb @@ -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)