I am encountering some strange problems with a WinForms App created in vb
.net.... Hopefully someoone knows something about how to get around this! Here it goes.
I have a form, with a tab control, and on the various tabs (there are 4 tabs), I have mainly labels, one or two list boxes and one or two command buttons.
I have just added a list box to a tab, and changed the Location of the tab on the Form.
When I run the app, I get an ArgumentOutOfRangeException on the following line:
Me.lstCompleted.ItemHeight = CType(resources.GetObject("lstCompleted.ItemHeight "), Integer)
I then did a Debug.Print on the resources value... here is the result:
>Debug.Print CType(resources.GetObject("lstCompleted.ItemHeight "), Integer)
At Design Time, the List Box has a height of 13. Obviously though, setting it to zero will be a problem.
I then tried cmmenting out the "problematic" line of code. I can then run the app, but the List box is not on the form. Also, the new position of the Tab Control I mentioned earlier, is not reflected on the form. So I ran the app again, this time placing a Breakpoint on the following line:
Me.lstCompleted.Visible = CType(resources.GetObject("lstCompleted.Visible"), Boolean)
When I look at the value with a Debug.Print statement, the following is the result:
>Debug.Print CType(resources.GetObject("lstCompleted.Visible"), Boolean)
Yet, Me.lstCompleted.Visible is True before encountering this line.
Can anyone tell me how to solve this type of problem? The frm.resx file contains my specified values and all of the expected default values (e.g. ItemHeight = 13, Visible = True etc,....) Yet many of the resources.GetObject(object,type) statements seem to be returning junk values. Where are these values coming from? Is there some manual refresh I need to perform on the project somewhere to keep values synchronised?
Also, I have noticed that after altering the position of some Form Controls, that the positions are not reflected at runtime... This concerned the tab control, the text of a Label, a newly added Menu didn't appear... and several other unexpected funky features! This was a problem I saw a few days ago, but now obviously things are more serious with exceptions occurring on standard lines of code!
Any help is much appreciated.