Database for meshes and loadbar measures done

This commit is contained in:
Anton 2021-02-05 15:20:44 +01:00
parent bc1bbf48f2
commit 0a948b3354
2 changed files with 46 additions and 40 deletions

Binary file not shown.

View File

@ -74,7 +74,7 @@ Public Class GUI
Private Sub Get_Database()
excelWB = excelApp.Workbooks.Open(HLCtFolder & "\Databas.xlsx")
For i = 1 To excelWB.Worksheets.Count
For i = 1 To 3 'excelWB.Worksheets.Count
Dim activeSheet As Excel.Worksheet
activeSheet = excelWB.Sheets(i)
@ -406,7 +406,7 @@ Public Class GUI
Dim materialInDT As String = serratedDT.Rows(0)(materialColumn)
If serratedCheckBoxBol = False Then
For i = 0 To serratedDT.Rows.Count - 1
If gratingType = typeInDT And gratingMaterial = materialInDT Then
If gratingMaterial = materialInDT AndAlso gratingType = typeInDT Then
serratedCheckBox.Name = "CheckBox_Serrated"
serratedCheckBox.Text = "Serrated"
serratedCheckBox.Left = 115
@ -424,7 +424,7 @@ Public Class GUI
Next
Else
For i = 0 To serratedDT.Rows.Count - 1
If gratingType = typeInDT And gratingMaterial = materialInDT Then
If gratingMaterial = materialInDT AndAlso gratingType = typeInDT Then
removeCheckBox = False
Exit For
End If
@ -434,50 +434,67 @@ Public Class GUI
Catch ex As Exception
End Try
Next
If serratedCheckBoxBol = True And removeCheckBox = True Then
If serratedCheckBoxBol = True AndAlso removeCheckBox = True Then
RemoveHandler serratedCheckBox.CheckedChanged, AddressOf CheckBox_Serrated_CheckedChanged
Me.Controls.RemoveByKey("CheckBox_Serrated")
serratedCheckBoxBol = False
End If
End If
' UPDATE MESHES
' CheckBox för lack eller ej varförzinkat eller obehandlat väljs, påverkar ej övrig kod (förutom kommentar att det är special order)
' Add Meshes
If gratingType = "Pressure Welded" Then
ComboBox_MeshSize.Items.Add("12x100 (B9)") 'Tillfällig
ComboBox_MeshSize.Items.Add("25x50 (F4)") 'Tillfällig
ComboBox_MeshSize.Items.Add("34x37 (H3)") 'Tillfällig
'For i = 1 To 5
' ComboBox_MeshSize.Items.Add("hej " & i) 'Hämta från databas
'Next
Else
ComboBox_MeshSize.Items.Add("22x22") 'Tillfällig
ComboBox_MeshSize.Items.Add("33x11") 'Tillfällig
'For i = 1 To 5
' ComboBox_MeshSize.Items.Add("Test " & i) 'Hämta från databas
'Next
End If
Update_AvalaibleMeshes()
End Sub
Private Sub CheckBox_Serrated_CheckedChanged(sender As Object, e As EventArgs)
If sender.Checked Then
' UPDATE MESHES
gratingSerrated = True
Update_AvalaibleMeshes()
Else
' UPDATE MESHES
gratingSerrated = False
Update_AvalaibleMeshes()
End If
End Sub
Private Sub Update_AvalaibleMeshes()
ComboBox_MeshSize.Items.Clear()
Dim meshesDT As DataTable = dataBase("Meshes")
Dim typeColumn As Integer = Get_ColumnIndex("TYPE", meshesDT)
Dim materialColumn As Integer = Get_ColumnIndex("MATERIAL", meshesDT)
Dim serratedColumn As Integer = Get_ColumnIndex("SERRATED", meshesDT)
ComboBox_MeshSize.Items.Add("12x100 (B9)")
Dim typeInDT As String = meshesDT.Rows(0)(typeColumn)
Dim materialInDT As String = meshesDT.Rows(0)(materialColumn)
Dim serratedInDT As Boolean = CBool(meshesDT.Rows(0)(serratedColumn))
For i = 0 To meshesDT.Rows.Count - 1
If gratingSerrated = serratedInDT AndAlso gratingMaterial = materialInDT AndAlso gratingType = typeInDT Then
Dim item As String
item = meshesDT.Rows(i)("LB-SPACING") & "x" & meshesDT.Rows(i)("CB-SPACING") & " (" & meshesDT.Rows(i)("NAME") & ")"
Dim addItem As Boolean = True
For j = 0 To ComboBox_MeshSize.Items.Count - 1
If item = ComboBox_MeshSize.Items(j) Then
addItem = False
Exit For
End If
Next
If addItem = True Then
ComboBox_MeshSize.Items.Add(item)
End If
End If
Try
typeInDT = meshesDT.Rows(i + 1)(typeColumn)
materialInDT = meshesDT.Rows(i + 1)(materialColumn)
serratedInDT = meshesDT.Rows(i + 1)(serratedColumn)
Catch ex As Exception
End Try
Next
If ComboBox_MeshSize.Items.Count = 0 Then
ComboBox_MeshSize.Items.Add("")
End If
End Sub
' --- When user changes mesh size ---
@ -778,16 +795,7 @@ Public Class GUI
' --- Settings button clicked ---
Private Sub SettingsButton_Click(sender As Object, e As EventArgs) Handles SettingsButton.Click
'Program.Update_KB()
excelSheet = excelWB.Sheets("Pressure_welded") 'Call sheet by name
'excelSheet = excelWB.Sheets(1) 'Call sheet by number
Dim temp1 As String = excelSheet.Range("A64").Value 'Call cell by name
Dim temp2 As Excel.XlPattern = excelSheet.Cells(79, 1).style.interior.pattern 'Call cell by row and column index
Program.Update_KB()
End Sub
' --- When export to SW button is pressed ---
@ -806,6 +814,4 @@ Public Class GUI
End Sub
End Class
' LENGTH OCH WIDTH BÖR RITAS TVÄRTOM
End Class