I am trying to write an aspx page that can set some visibility of a control based on whether it has data in it or not. Here is a code snippet:
Any thoughts on why this gives a "System.NullReferenceException: Object reference not set to an instance of an object."
Thanks,
Kevin Devine
Network Systems Administrator
Euclid Public Library
kdevine@euclidlibraryNOSPAM.org
VB.NET:
[size=2]
Lbl = [/size][size=2][color=#0000ff]New[/color][/size][size=2] Label
Lbl = [/size][size=2][color=#0000ff]CType[/color][/size][size=2]([/size][size=2][color=#0000ff]Me[/color][/size][size=2].FindControl("lblGroup" & i), Label)
[/size][size=2][color=#0000ff]If[/color][/size][size=2] [/size][size=2][color=#0000ff]Not[/color][/size][size=2] IsDBNull(dr("GroupName")) [/size][size=2][color=#0000ff]Then[/color][/size][size=2] Lbl.Text = dr("GroupName") & ":"
Lbl.Visible = [/size][size=2][color=#0000ff]True
[/color][/size]
Any thoughts on why this gives a "System.NullReferenceException: Object reference not set to an instance of an object."
Thanks,
Kevin Devine
Network Systems Administrator
Euclid Public Library
kdevine@euclidlibraryNOSPAM.org