From 4283e09c79cd1f2af9d8aca981dfba429a59c142 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 8 Feb 2021 13:41:59 +0100 Subject: [PATCH] Small fixes --- Wardrobe/GUI_Gratings_Data.vb | 47 +++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/Wardrobe/GUI_Gratings_Data.vb b/Wardrobe/GUI_Gratings_Data.vb index 94f2108..8c786e8 100644 --- a/Wardrobe/GUI_Gratings_Data.vb +++ b/Wardrobe/GUI_Gratings_Data.vb @@ -2,7 +2,7 @@ Public Shared gratingMaxW As Decimal = 1000 Public Shared gratingMaxL As Decimal = 1000 - Private Shared gratingType, gratingMaterial, gratingMesh As String + Private Shared gratingType, gratingMaterial, gratingMesh, gratingName As String Private Shared gratingSerrated As Boolean = False Private Shared loadBarSpacing, crossBarSpacing, gratingHeight, loadBarThickness As Integer @@ -167,12 +167,49 @@ gratingMesh = GUI.ComboBox_MeshSize.Text loadBarSpacing = CInt(gratingMesh.Split("x")(0)) crossBarSpacing = CInt(gratingMesh.Split("x")(1).Split(" ")(0)) + gratingName = gratingMesh.Split("(")(1).Split(")")(0) ' Add heights - If loadBarSpacing = 12 And crossBarSpacing = 100 Then - GUI.ComboBox_Height.Items.Add("20") - GUI.ComboBox_Height.Items.Add("25") - 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 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 Then + + Dim addItem As Boolean = True + For j = 0 To tempList.Count - 1 + If meshesDT.Rows(i)("LB-HEIGHT") = tempList(j) Then + addItem = False + Exit For + End If + Next + If addItem = True Then + tempList.Add(CInt(meshesDT.Rows(i)("LB-HEIGHT"))) + 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")) + Catch ex As Exception + End Try + Next + + tempList.Sort() + For i = 0 To tempList.Count - 2 + GUI.ComboBox_Height.Items.Add(tempList(i)) + Next End Sub Public Shared Sub HeightChanged(sender As Object, e As EventArgs)