Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 12th, 2005, 12:08 PM
Registered User
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to colmtheirishman
Default Runtime Problems after adding new controls

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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Controls At Runtime with MFC. burtlo Visual C++ 2005 2 October 13th, 2007 06:36 AM
Controls at runtime ITGeek ASP.NET 1.0 and 1.1 Basics 4 July 11th, 2007 05:23 AM
Adding forms at runtime Bhalchandra Pro VB 6 1 April 17th, 2007 12:45 PM
Adding button at runtime ehabinl ASP.NET 1.0 and 1.1 Professional 2 August 7th, 2006 02:46 PM
Adding button at runtime ehabinl BOOK: Professional C#, 2nd and 3rd Editions 0 August 7th, 2006 03:48 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.