Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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:

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...