Click here to Skip to main content
15,886,963 members
Home / Discussions / C#
   

C#

 
Questioni have two threads and make a group of it? Pin
imran_rafique19-Nov-02 16:31
imran_rafique19-Nov-02 16:31 
AnswerRe: i have two threads and make a group of it? Pin
Joshua Nussbaum19-Nov-02 20:57
Joshua Nussbaum19-Nov-02 20:57 
Questionwhy use property in class? Pin
zhoujun19-Nov-02 14:40
zhoujun19-Nov-02 14:40 
AnswerRe: why use property in class? Pin
Christian Graus19-Nov-02 19:43
protectorChristian Graus19-Nov-02 19:43 
AnswerRe: why use property in class? Pin
ian mariano20-Nov-02 2:52
ian mariano20-Nov-02 2:52 
AnswerRe: why use property in class? Pin
LongRange.Shooter21-Nov-02 10:07
LongRange.Shooter21-Nov-02 10:07 
Questionhow to display bitmap in MDI form Pin
Linder Wang19-Nov-02 14:19
sussLinder Wang19-Nov-02 14:19 
GeneralCollection editor problem Pin
dacris19-Nov-02 11:24
dacris19-Nov-02 11:24 
Consider this. There's a custom control, MyCtl which displays a tree of items. It has a collection of MyItem objects. Both MyCtl and MyItem have item collections (that is, you can have sub-items, sub-sub-items, and so forth). The item collections in MyCtl and MyItem are marked as DesignerSerializationVisibility.Content, so that they are saved in the code when modified through the designer. Items can successfully be added to the item collection of the MyCtl control, through the designer (collection editor). When sub-items are added, with the Collection Editor, an "Object reference not set to an instance of an object" message comes up when OK is clicked and the sub-items are lost.

Cry | :((

I've created a small test project to show you this behavior, along with a set of instructions, shown below.

The ZIP file of the sample project is found at:

http://www.dacris.com/collections.zip

*ZIP file updated with VS.NET 2002 project files

Here are the instructions:
1. Open the attached Zip file and extract it to an empty folder.
2. Open Collections.sln in the VS.NET IDE.
3. Build the solution to generate the Collections class library.
4. Open Form1.cs in the Windows Forms designer.
5. Select the control containing the tree of strings (it is set to DockStyle=Fill, so just click the form's client area).
6. Scroll the property grid all the way down.
7. Click the '...' button next to the Items collection property.
8. Select the third item in the list of items.
9. In the property grid for that item, select the '...' button next to the Items collection property.
10. Click the Add button on the dialog box that comes up.
11. Select the newly added item and enter a string value for the Text property (such as 'The disappearing item') in the property grid of the newly added item.
12. Click OK. Notice how the item has appeared on the control in the form, and it is called 'The disappearing item'.
13. Click OK again on the dialog box that remains. An "Object reference not set to an instance of an object" message should appear. Click OK.
14. Click Cancel. Another message will appear. Click OK to close it.
15. Click Cancel again.
Notice how the item has now disappeared from both the control and the component tray, and the Form1 window is not marked as modified (asterisk).

How can I get the items to persist on infinite depth levels? How on earth did MS do it with the TreeView and Menu controls? Confused | :confused: I am stuck and I need your help.

I shall award my full gratitude to the first person who manages to successfully add a sub-item and save it, and then explain to me how they did it.

Thanks in advance.
GeneralRe: Collection editor problem Pin
leppie19-Nov-02 11:36
leppie19-Nov-02 11:36 
GeneralRe: Collection editor problem Pin
dacris19-Nov-02 12:14
dacris19-Nov-02 12:14 
QuestionUnfocus a form when it's created? Pin
Bog19-Nov-02 8:53
Bog19-Nov-02 8:53 
AnswerRe: Unfocus a form when it's created? Pin
LongRange.Shooter19-Nov-02 11:13
LongRange.Shooter19-Nov-02 11:13 
AnswerRe: I don't understand your q very well, but.. Pin
Masaaki Onishi19-Nov-02 19:20
Masaaki Onishi19-Nov-02 19:20 
GeneralSplit string by string Pin
dezoe19-Nov-02 6:43
dezoe19-Nov-02 6:43 
GeneralRe: Split string by string Pin
leppie19-Nov-02 11:12
leppie19-Nov-02 11:12 
GeneralRe: Split string by string Pin
Eric Gunnerson (msft)19-Nov-02 11:25
Eric Gunnerson (msft)19-Nov-02 11:25 
GeneralRe: Split string by string Pin
dezoe19-Nov-02 12:41
dezoe19-Nov-02 12:41 
QuestionEnabled ForeColor? Pin
Delegate19-Nov-02 6:41
Delegate19-Nov-02 6:41 
GeneralSqlReader.GetValues() problem Pin
leppie19-Nov-02 6:32
leppie19-Nov-02 6:32 
GeneralRemoving EnhancedMetafile from clipboard fails Pin
gharrison19-Nov-02 5:27
gharrison19-Nov-02 5:27 
GeneralCOM+ Windows API Pin
thematt19-Nov-02 2:52
thematt19-Nov-02 2:52 
GeneralRe: COM+ Windows API Pin
leppie19-Nov-02 11:07
leppie19-Nov-02 11:07 
GeneralRe: COM+ Windows API Pin
thematt20-Nov-02 2:21
thematt20-Nov-02 2:21 
GeneralBinding Collection to Datagrid Pin
thematt19-Nov-02 2:41
thematt19-Nov-02 2:41 
GeneralRe: Binding Collection to Datagrid Pin
leppie19-Nov-02 10:59
leppie19-Nov-02 10:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.