Your description is really not very clear. Are you saying that if one of the fields in your TemplateValues object is Nothing or an empty string, you want to replace the template field with "N/A"? If so then I'd say that you have two options:
1. Build that functionality into your TemplateValues class:2. Use a similar If statement when calling Replace each time:vb.net Code:
Public Class TemplateViews Private _clientName As String '... Public Property ClientName() As String Get Return If(String.IsNullOrEmpty(Me._clientName), "N/A", Me._clientName) End Get Set(ByVal value As String) Me._clientName = value End Set End Property '... End ClassThe first option would be preferable unless that functionality is not logically part of the TemplateValues class.vb.net Code:
stringToParse = stringToParse.Replace("[CLIENTNAME]", If(String.IsNullOrEmpty(tv.ClientName), "N/A", tv.ClientName))




Reply With Quote