ASKER
Else
Inlist = False
Try
Inlist = dropdownCustXBanks.Items.Contains(New ListItem(CurrOBXValue))
Catch ex As Exception
End Try
If Inlist = True Then
dropdownCustXBanks.SelectedValue = CurrOBXValue
End If
ASKER
ASKER
Else
Inlist = False
Inlist = dropdownCustXBanks.Items.Contains(New ListItem(CurrOBXValue))
If Inlist = True Then
dropdownCustXBanks.SelectedValue = CurrOBXValue
End If
ASKER
ASKER
Else
Inlist = False
Inlist = dropdownCustXBanks.Items.Contains(New ListItem(CurrOBXTRN))
If Inlist = True Then
dropdownCustXBanks.SelectedValue = CurrOBXTRN
End If
ASKER
ASKER
Inlist = False
Inlist = dropdownCustXBanks.Items.Contains(New ListItem(CurrOBXTRN))
If Inlist = True Then
dropdownCustXBanks.SelectedValue = CurrOBXTRN
End If
ASKER
ASKER
Sub Refresh_CustXBanksDDL_From_Table(ByRef OBXFunction As String)
'This subroutine re-initializes the Order Bank Exclusions from the SQL view
Dim HasOBX As Boolean
Dim NumOBX As Integer
'Mark the current selection in the DDL
Dim CurrOBXValue As String = "- Select Bank -"
Dim CurrOBXTRN As String = "0"
Dim Inlist As Boolean = False
If OBXFunction = "Add" Then
CurrOBXTRN = txtboxExclTRN.Text
CurrOBXValue = txtboxExclBank.Text
ElseIf OBXFunction = "Del" Or DropDownOrderNum.Text <> txtboxOrderNum.Text Then
CurrOBXTRN = "0"
CurrOBXValue = "- Select Bank -"
ElseIf dropdownCustXBanks.SelectedValue.ToString <> "" Then
CurrOBXTRN = dropdownCustXBanks.SelectedValue
CurrOBXValue = dropdownCustXBanks.SelectedItem.Text
End If
'Identify the current number of banks in the Order Bank Exclusion dropdown. Subtract 1 to
'exclude the "- Select Bank -" entry.
Dim DDLOrderExcls As Integer
DDLOrderExcls = dropdownCustXBanks.Items.Count - 1
'Clear the drop down list
dropdownCustXBanks.Items.Clear()
'Check the SQL table for exclusions for the current order
Call Check_For_Order_Exclusions(HasOBX, NumOBX)
'If there are exclusions in the Order Bank Exclusion Table...
If NumOBX > 0 Then
dropdownCustXBanks.Items.Insert(0, "- Select Bank -")
dropdownCustXBanks.SelectedValue = "- Select Bank -"
dropdownCustXBanks.SelectedIndex = 0
dropdownCustXBanks.DataBind()
If CurrOBXValue = "- Select Bank -" Then
dropdownCustXBanks.SelectedValue = "- Select Bank -"
dropdownCustXBanks.SelectedIndex = 0
'Sets the selected item to the saved selection.
'ElseIf dropdownCustXBanks.Items.Contains(New ListItem(CurrOBXValue)) Then
Else
Inlist = dropdownCustXBanks.Items.Contains(New ListItem(CurrOBXTRN))
If Inlist = True Then
dropdownCustXBanks.SelectedValue = CurrOBXTRN
End If
'Otherwise, if there are no exclusions in the Order Exclusion table either, simply
'populate the DDL with the "- Select Bank -" entry and make it the current selection.
End If
Else
dropdownCustXBanks.Items.Insert(0, "- Select Bank -")
dropdownCustXBanks.SelectedValue = "- Select Bank -"
dropdownCustXBanks.SelectedIndex = 0
End If
End Sub
ASKER
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.
TRUSTED BY
If so then a quick fix would be just to wrap your code in a try catch block.