M
Mark Kamoski
Hi--
Is there any significant difference between the code samples below?
If so, what is it? And, which is preferred?
Also, is there ANY need for setting to Nothing ever in a case like this?
(Put aside discussion of error handling, for now.)
Please advise.
Thank you
--Mark
'''''''''''''''''''''''''''''Sample 1
Private Sub BindPopupExBKDS()
Dim objButton As Button
objButton = Nothing
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd1"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
objButton = Nothing
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd2"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
End Sub
'''''''''''''''''''''''''''''''''Sample 2
Private Sub BindPopupExBKDS()
Dim objButton As Button
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd1"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd2"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
End Sub
''''''''''''''''''''Sample 3
Private Sub BindPopupExBKDS()
Dim objButton As Button
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd1"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd2"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
End Sub
Is there any significant difference between the code samples below?
If so, what is it? And, which is preferred?
Also, is there ANY need for setting to Nothing ever in a case like this?
(Put aside discussion of error handling, for now.)
Please advise.
Thank you
--Mark
'''''''''''''''''''''''''''''Sample 1
Private Sub BindPopupExBKDS()
Dim objButton As Button
objButton = Nothing
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd1"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
objButton = Nothing
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd2"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
End Sub
'''''''''''''''''''''''''''''''''Sample 2
Private Sub BindPopupExBKDS()
Dim objButton As Button
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd1"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
objButton = New Button()
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd2"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
End Sub
''''''''''''''''''''Sample 3
Private Sub BindPopupExBKDS()
Dim objButton As Button
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd1"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
objButton = CType(pnlJobSheetDetailBKDS.FindControl("btnDetailAdd2"),
Button)
objButton.Attributes.Add("onclick", "return ShowPopup();")
End Sub