Problem with resx files

rbulph

Junior Contributor
Joined
Feb 17, 2003
Messages
397
I have a class which inherits from the combobox ("JCombo"). Its items are an ComboBox.ObjectCollection of a type of object ("Class1") which I define in my project. The items are set in the New event of JCombo. An instance of JCombo appears in a form and a user control in my application, having been added at design time.

If I make any changes in Class1 then the project won't compile - I get the error "Invalid Resx file" and a reference to some code in the resx file for the form and user control which contain the JCombo. The code which is referenced looks no different to a random series of letters and numbers to me, and clearly I can't correct this.

So what's the best solution to this? Do I need to delete the resx file each time I make a change to Class1? Should I set the items elsewhere?
 
try add control at runtime?

have you tried adding the control at runtime instead? It's fairly easy to do and then the form designer shouldn't write anything out to the resx.

Here's a quick example, in case you haven't done that before. I'm running this code in a basic class (not a form) and loop through this routine for multiple controls.

What is not seen is I have set grp to a groupbox on the target form; iXpos, etc. are integers to track where to insert the control based on the previous control:
Visual Basic:
cbo = New ComboBox
cbo.Name = xNode.Attributes("name").Value
cbo.Left = iXpos + iWidth + iOffset
cbo.Top = iYpos
cbo.Width = iWidth * 1.5
cbo.Height = iHeight
grp.Controls.Add(cbo)
iYpos += iHeight + iOffset

'handling all of the cbo's w/ one routine; looking at the cbo's name in that routine
AddHandler cbo.TextChanged, AddressOf grpCriteria_TextChanged
 
Thanks. In fact, just setting the items in the load event of the form/control where I use JCombo seems to be the simplest way.
 
Back
Top