Serrated checkbox conditions
This commit is contained in:
parent
27a464dd6a
commit
a9567f6b39
BIN
Databas.xlsx
BIN
Databas.xlsx
Binary file not shown.
|
|
@ -31,7 +31,7 @@ Public Class GUI
|
||||||
Dim pointsOrder As New List(Of String)
|
Dim pointsOrder As New List(Of String)
|
||||||
|
|
||||||
Dim gratingType, gratingMaterial, gratingMesh As String
|
Dim gratingType, gratingMaterial, gratingMesh As String
|
||||||
Dim gratingSerrated As Boolean
|
Dim gratingSerrated As Boolean = False
|
||||||
Dim loadBarSpacing, crossBarSpacing, gratingHeight, loadBarThickness As Integer
|
Dim loadBarSpacing, crossBarSpacing, gratingHeight, loadBarThickness As Integer
|
||||||
|
|
||||||
Dim pointCounter As Integer
|
Dim pointCounter As Integer
|
||||||
|
|
@ -42,6 +42,8 @@ Public Class GUI
|
||||||
Dim excelWB As Excel.Workbook
|
Dim excelWB As Excel.Workbook
|
||||||
Dim excelSheet As Excel.Worksheet
|
Dim excelSheet As Excel.Worksheet
|
||||||
|
|
||||||
|
Dim serratedCheckBoxBol As Boolean = False
|
||||||
|
|
||||||
' --- Start method (main) for GUI ---
|
' --- Start method (main) for GUI ---
|
||||||
Sub GUI_load() Handles MyBase.Load
|
Sub GUI_load() Handles MyBase.Load
|
||||||
containerPanel = DrawingPanel
|
containerPanel = DrawingPanel
|
||||||
|
|
@ -319,28 +321,15 @@ Public Class GUI
|
||||||
gratingType = ComboBox_TypeChooser.Text
|
gratingType = ComboBox_TypeChooser.Text
|
||||||
ComboBox_Material.Enabled = True
|
ComboBox_Material.Enabled = True
|
||||||
ComboBox_Material.Items.Clear()
|
ComboBox_Material.Items.Clear()
|
||||||
|
|
||||||
Dim materialSheet As Excel.Worksheet
|
Dim materialSheet As Excel.Worksheet
|
||||||
materialSheet = excelWB.Sheets("Material")
|
materialSheet = excelWB.Sheets("Material")
|
||||||
Dim typeColumn As Integer = 0
|
|
||||||
Dim columnCounter As Integer = 1
|
|
||||||
While typeColumn = 0
|
|
||||||
If materialSheet.Cells(1, columnCounter).value = "TYPE" Then
|
|
||||||
typeColumn = materialSheet.Cells(1, columnCounter).column
|
|
||||||
|
|
||||||
End If
|
Dim typeColumn As Integer
|
||||||
columnCounter = columnCounter + 1
|
typeColumn = Get_ColumnIndex("TYPE", materialSheet)
|
||||||
End While
|
|
||||||
|
|
||||||
Dim materialColumn As Integer = 0
|
|
||||||
columnCounter = 1
|
|
||||||
While materialColumn = 0
|
|
||||||
If materialSheet.Cells(1, columnCounter).value = "MATERIAL" Then
|
|
||||||
materialColumn = materialSheet.Cells(1, columnCounter).column
|
|
||||||
|
|
||||||
End If
|
Dim materialColumn As Integer
|
||||||
columnCounter = columnCounter + 1
|
materialColumn = Get_ColumnIndex("MATERIAL", materialSheet)
|
||||||
End While
|
|
||||||
|
|
||||||
Dim typeInExcel As String
|
Dim typeInExcel As String
|
||||||
Dim rowCounter As Integer = 2
|
Dim rowCounter As Integer = 2
|
||||||
|
|
@ -357,30 +346,73 @@ Public Class GUI
|
||||||
ComboBox_Material.Text = ComboBox_Material.Items(0)
|
ComboBox_Material.Text = ComboBox_Material.Items(0)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function Get_ColumnIndex(columnName As String, activeSheet As Excel.Worksheet)
|
||||||
|
Dim columnIndex As Integer = 0
|
||||||
|
Dim columnCounter As Integer = 1
|
||||||
|
While columnIndex = 0
|
||||||
|
If activeSheet.Cells(1, columnCounter).value = columnName Then
|
||||||
|
columnIndex = activeSheet.Cells(1, columnCounter).column
|
||||||
|
|
||||||
|
End If
|
||||||
|
columnCounter = columnCounter + 1
|
||||||
|
End While
|
||||||
|
|
||||||
|
Return columnIndex
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
' --- When user changes grating material ---
|
' --- When user changes grating material ---
|
||||||
Private Sub ComboBox_Material_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Material.TextChanged
|
Private Sub ComboBox_Material_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Material.TextChanged
|
||||||
ComboBox_MeshSize.Enabled = True
|
ComboBox_MeshSize.Enabled = True
|
||||||
ComboBox_MeshSize.Items.Clear()
|
ComboBox_MeshSize.Items.Clear()
|
||||||
gratingMaterial = ComboBox_Material.Text
|
gratingMaterial = ComboBox_Material.Text
|
||||||
gratingSerrated = False 'FIXA
|
|
||||||
|
|
||||||
' Add toothing option
|
Dim serratedSheet As Excel.Worksheet
|
||||||
If gratingType = "Pressure Welded" Then
|
serratedSheet = excelWB.Sheets("Serrated")
|
||||||
If gratingMaterial = "Standard" Or gratingMaterial = "Stainless Steel (Pickled)" Then
|
|
||||||
|
Dim typeColumn As Integer
|
||||||
|
typeColumn = Get_ColumnIndex("TYPE", serratedSheet)
|
||||||
|
|
||||||
|
|
||||||
|
Dim materialColumn As Integer
|
||||||
|
materialColumn = Get_ColumnIndex("MATERIAL", serratedSheet)
|
||||||
|
|
||||||
|
Dim typeInExcel As String
|
||||||
|
Dim materialInExcel As String
|
||||||
|
Dim removeCheckBox As Boolean = True
|
||||||
|
Dim rowCounter As Integer = 2
|
||||||
|
materialInExcel = serratedSheet.Cells(rowCounter, materialColumn).value
|
||||||
|
typeInExcel = serratedSheet.Cells(rowCounter, typeColumn).value
|
||||||
|
If serratedCheckBoxBol = False Then
|
||||||
|
While typeInExcel <> ""
|
||||||
|
If gratingType = typeInExcel And gratingMaterial = materialInExcel Then
|
||||||
Dim serratedCheckBox As New CheckBox
|
Dim serratedCheckBox As New CheckBox
|
||||||
serratedCheckBox.Name = "CheckBox_Serrated"
|
serratedCheckBox.Name = "CheckBox_Serrated"
|
||||||
serratedCheckBox.Text = "Serrated"
|
serratedCheckBox.Text = "Serrated"
|
||||||
serratedCheckBox.Left = 115
|
serratedCheckBox.Left = 115
|
||||||
serratedCheckBox.Top = 115
|
serratedCheckBox.Top = 115
|
||||||
Me.Controls.Add(serratedCheckBox)
|
Me.Controls.Add(serratedCheckBox)
|
||||||
|
serratedCheckBoxBol = True
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
rowCounter = rowCounter + 1
|
||||||
|
typeInExcel = serratedSheet.Cells(rowCounter, typeColumn).value
|
||||||
|
materialInExcel = serratedSheet.Cells(rowCounter, materialColumn).value
|
||||||
|
End While
|
||||||
|
Else
|
||||||
|
While typeInExcel <> ""
|
||||||
|
If gratingType = typeInExcel And gratingMaterial = materialInExcel Then
|
||||||
|
removeCheckBox = False
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
rowCounter = rowCounter + 1
|
||||||
|
typeInExcel = serratedSheet.Cells(rowCounter, typeColumn).value
|
||||||
|
materialInExcel = serratedSheet.Cells(rowCounter, materialColumn).value
|
||||||
|
End While
|
||||||
|
If serratedCheckBoxBol = True And removeCheckBox = True Then
|
||||||
|
Me.Controls.RemoveByKey("CheckBox_Serrated")
|
||||||
|
serratedCheckBoxBol = False
|
||||||
End If
|
End If
|
||||||
ElseIf gratingMaterial = "Standard" Or gratingMaterial = "Aluminum" Then
|
|
||||||
Dim serratedCheckBox As New CheckBox
|
|
||||||
serratedCheckBox.Name = "CheckBox_Serrated"
|
|
||||||
serratedCheckBox.Text = "Serrated"
|
|
||||||
serratedCheckBox.Left = 115
|
|
||||||
serratedCheckBox.Top = 115
|
|
||||||
Me.Controls.Add(serratedCheckBox)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Add Meshes
|
' Add Meshes
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue