Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FindByText problem

Status
Not open for further replies.

slatet

Programmer
Sep 11, 2003
116
US
I am attempting to populate a dropdown for hours and minutes. I use the following and it returns Object reference not set to an instance of an object. It definately returns a value to vMinutes. Can anyone be of help?


string vMinutes = vStartDate.TimeOfDay.Minutes.ToString();
ListStartHour.Items.FindByText(vMinutes.Trim()).Selected = true;
 
The following statement:
ListStartHour.Items.FindByText(vMinutes.Trim()) returns a null reference if the entry doesn't exists otherwise a reference to an ListItem object.
So, you should first check for null reference!
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top