So I created the nifty little Function below:
Private Function GetWebFormValue(ByRef WebForm As System.Collections.Specialized.NameValueCollection, _
ByVal ControlName As String) As String
Try
Return WebForm(ControlName).ToString
Catch
Return String.Empty
End Try
End Function
Here is how to use it:
pstrTemp = GetWebFormValue(Request.Form, "txtZipCode")
If you have an easier, better way to do this same thing, please let me know. Best of all, this will not cause an exception!!!
Tip Submitted By: David McCarter
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.
