Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
A.Acheson
in reply to: bbrumfield

You can check the string value coming from the the input list box selection. Many ways to write this, check if it is Nothing, check if it has an empty string, or use the string function to return a boolean value. 

 

If oSelSheetMaterialStockCodeOpt2 Is Nothing Then
MsgBox("Nothing Selected")
Else MsgBox(oSelSheetMaterialStockCodeOpt1) End If

 

If oSelSheetMaterialStockCodeOpt1 = Nothing Then 
   MsgBox("Nothing Selected")
Else
MsgBox(oSelSheetMaterialStockCodeOpt1) End If
If oSelSheetMaterialStockCodeOpt1 = "" Then 
    MsgBox("Nothing Selected")
Else
MsgBox(oSelSheetMaterialStockCodeOpt1) End If
If String.IsNullOrEmpty(oSelSheetMaterialStockCodeOpt1) = True Then 
MsgBox("Nothing Selected") Else
MsgBox(oSelSheetMaterialStockCodeOpt1)
End If

 

 

 

String Check Code

Dim oDoc As Document = ThisDoc.Document

Dim CustTypeALU As New ArrayList
CustTypeALU.Add(".063, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0003")
CustTypeALU.Add(".125, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0005")
CustTypeALU.Add(".090, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0007")
CustTypeALU.Add(".190, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0009")
CustTypeALU.Add(".050, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0013")
CustTypeALU.Add(".030, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0016")
CustTypeALU.Add(".080, Sheet, Aluminum, 5052-H32, 60.00 x 120.00 | ME-CRS-0017")

Dim oSelSheetMaterialStockCodeOpt1 As String = InputListBox("Select Sheet Material Stock Code", 
	CustTypeALU, oSheetMaterialStockCodeOpt1, Title := "ALU Sheet Selection", _
	ListName := "ALU Sheet Stock Code")

If oSelSheetMaterialStockCodeOpt1 = Nothing Then 'can also use "" as an empty string instead of Nothing
Else
	sSplit = Split(oSelSheetMaterialStockCodeOpt1, "|")
	oDesc = sSplit(0) 
	oPN = sSplit(1) 

	'if this custom property doesn't exist, this next line will also create it if needed (no error shown)
	iProperties.Value("Custom", "Material Stock Code 1") = oPN

	MsgBox(iProperties.Value("Custom", "Material Stock Code 1") )
End If
Dim CustTypeGALV As New ArrayList
CustTypeGALV.Add("16GA, Sheet, Galvanneal Steel, 60.00 x 120.00 | ME-GALN-0001")
CustTypeGALV.Add("18GA, Sheet, Galvanneal Steel, 60.00 x 120.00 | ME-GALN-0002")
CustTypeGALV.Add("22GA, Sheet, Galvanneal Steel, 60.00 x 120.00 | ME-GALN-0003")
CustTypeGALV.Add("14GA, Sheet, Galvanized Steel, 60.00 x 120.00 | ME-GALV-0001")
CustTypeGALV.Add("16GA, Sheet, Galvanized Steel, 60.00 x 120.00 | ME-GALV-0002")
CustTypeGALV.Add("18GA, Sheet, Galvanized Steel, 60.00 x 120.00 | ME-GALV-0003")
CustTypeGALV.Add("24GA, Sheet, Galvanized Steel, 60.00 x 120.00 | ME-GALV-0004")

Dim oSelSheetMaterialStockCodeOpt2 As String = InputListBox("Select Sheet Material Stock Code", 
	CustTypeGALV, oSheetMaterialStockCodeOpt2, Title := "GALV Sheet Selection", _
	ListName := "GALV Sheet Stock Code")
If oSelSheetMaterialStockCodeOpt2 = Nothing Then
Else
sSplit = Split(oSelSheetMaterialStockCodeOpt2, "|")
oDesc = sSplit(0) 
oPN = sSplit(1) 

'if this custom property doesn't exist, this next line will also create it if needed (no error shown)
iProperties.Value("Custom", "Material Stock Code 1") = oPN

MsgBox(iProperties.Value("Custom", "Material Stock Code 1")) 
End If

 

 

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan