[size=2][color=#0000ff]Public[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] LimitChars([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] s [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Object[/color][/size][size=2]) [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size]
[color=#0000ff] [size=2]If[/size][/color][size=2] IsDBNull(s) [/size][size=2][color=#0000ff]Then[/color][/size]
[color=#0000ff] [size=2]Return[/size][/color][size=2] ""[/size]
[size=2][color=#0000ff]Else[/color][/size]
[color=#0000ff] [size=2]Dim[/size][/color][size=2] ss [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = Convert.ToString(s)[/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] len [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2] = ss.Length[/size]
[size=2][color=#0000ff]If[/color][/size][size=2] len > 30 [/size][size=2][color=#0000ff]Then[/color][/size]
[size=2]len = 30[/size]
[size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If[/color][/size]
[color=#0000ff] [size=2]Return[/size][/color][size=2] ss.Substring(0, len)[/size]
[size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If[/color][/size]
[size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Function
[/color][/size]