Yeah, but the form doesn't actually RENDER until it's shown... So you can actually do some conjigggery to the list and the problems don't show up until later.
Two things, the first of which shouldn't have impact, but you should set the .ValueMember and .DisplayMember first, then the .DataSource - with data tables it's largely irrelevant, but sometimes it matters (altho agin, it's not something germain to this issue, just one of those things that triggers my CDO.)Code:lbHatch.DataSource = mDT lbHatch.DisplayMember = "Hatchery" lbHatch.ValueMember = "HatcheryID" Me.lbHatch.SelectedIndex = -1 For x = 0 To Me.lbHatch.Items.Count - 1 If DirectCast(CType(Me.lbHatch.Items(x), DataRowView).Item("HatcheryID"), Guid) = mHatchID Then Me.lbHatch.SelectedIndex = x End If Next
Second... the bits marked in red... I'm curious what would happen if you were to comment those out and feed it an empty table... do you still get the error or not? (I'm not in an environment where I can check this stuff out myself). But to me that spot seems the most likely candidate... why? I don't know.
-tg




Reply With Quote