Can anyone help me with this one, I'm all out of ideas :sigh: I have a custom Component deriving from Component. This component also implements the IListSource interface. The most important method I have to implement for this is GetList(); In the GetList method I need to obtain the parents type where my component is placed on. In this case a standard form derived from System.Windows.Forms.Form. I tried to do the following: IDesignerHost host = Site.Container as System.ComponentModel.Design.IDesignerHost; With the host I have now, I can get the RootComponent, BUT, and now comes the problem, the RootComponent is at that time the baseclass of the actual parent object. So I get System.Windows.Forms.Form instead of my derived parent class' type. I've discovered that this is because the designerhost is at that moment still in the loading state. The problem is that the GetList() is called before the loading state finishes and by the time the host is fully loaded, it it already too late, GetList isn't called again. Can anyone help me with this ? I'll be worshipping you until the end of my days ;)
2sky
Posts
-
Getting a custom components' parent -
Weird problem while inserting a recordI get the following output if I don't create the additional DataView: Row 1 Row 2 Row 4 ----- Row 1 Row 2 Row 3 Row 4 And this is the output when the DataView object is created based on the table: Row 1 Row 2 Row 4 ----- Row 1 Row 2 Row 4 Row 3 I don't see, why the DevaultView of the table changes the order of the DataViewRows, just because I create another DataView object based on this DataTable. Also, when I go in debug mode and check the Rows collection of the DataTable, the rows appear as one would expect (1, 2, 3, 4).
-
Weird problem while inserting a recordHello, I wonder if anyone can help me with this. I try to insert a record in a DataTable, and everything works absolutely perfect. UNTIL I create a custom DataView object based on the table. Here is a small sample, when you take the DataView myView = new DataView(table); line out of comment the record isn't at the correct position anymore. Any help is much appreciated !!!!
DataTable table = new DataTable("Table"); DataColumn colID = table.Columns.Add("ID", typeof(int)); DataColumn colName = table.Columns.Add("Name", typeof(String)); colID.AllowDBNull = false; table.Rows.Add(new object[] {1, "Row 1"}); table.Rows.Add(new object[] {2, "Row 2"}); table.Rows.Add(new object[] {4, "Row 4"}); table.AcceptChanges(); //DataView myView = new DataView(table); foreach(DataRowView row in table.DefaultView) { Console.WriteLine(row["Name"]); } Console.WriteLine("-------------------------------------------------------"); DataRowView cindyView = table.DefaultView.AddNew(); cindyView["ID"] = 3; cindyView["Name"] = "Row 3"; Object[] ItemArray = cindyView.Row.ItemArray; cindyView.CancelEdit(); DataRow cindy = table.NewRow(); cindy.ItemArray = ItemArray; cindy.EndEdit(); table.Rows.InsertAt(cindy, 2); table.DefaultView.RowStateFilter = DataViewRowState.None; table.DefaultView.RowStateFilter = DataViewRowState.CurrentRows; foreach(DataRowView row in table.DefaultView) { Console.WriteLine(row["Name"]); }
-
Will VS.NET 2002 Projects work in 2K3?I think it's best to just open your 2002 projects in 2003 and recompile them... I found that Microsoft didn't change much of their methods' parameters or functions, just added some new stuff to the .NET framework...
-
ImportRow QuestionWoops, overlooked that one :-O Thanks Andres !!! :cool:
-
ImportRow QuestionI have this program where I'm supposed to copy a datarow into another databale. Herefore I use the ImportRow method. The problem is that this method does not return the newly created datarow. Can anyone tell me how to get the new datarow that is created after calling ImportRow? Or is there a better way to copy a datarow between tables? Thanks in advance
-
Microsoft's ShellCmd sample freezes windowsI'm running WXP SP1 with Visual Studio 2003 (.NET 1.1) ... VERY weird :~ I've just reinstalled windows this week and this is the only strange thing I encountered up until now...
-
Microsoft's ShellCmd sample freezes windowsYesterday, I was trying to create a shell extension for adding items to the context menu inside windows explorer. The .NET SDK comes with a sample application for this, shellcmd, but when I use this extension and right-click on an explorer item (in this case Folder items), every program that's running will be frozen. Anyone has an idea why this is?
-
vertex shaderFor version 2, I think there are some samples on www.gamedev.net I thought version 3.0 didn't exist yet :confused:
-
How to link msvcr70.dll into my program in VC++.netThe Visual C++ merge module can be found in \Program Files\Common Files\Merge Modules There you choose the vc_crt.msm file (200KB)...
-
How to link msvcr70.dll into my program in VC++.netYou can deploy your program using the Deployment Wizard in Visual Studio, then merge the VC++ Redistributable Merge Module with you setup files.
-
NotifyIcon and ContextMenu Bug ??If you make sure the trayicons' "Icon" property is set to a valid icon, you should be able to copy-paste the code below in an empty C# project: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace NotifyMenu { public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.NotifyIcon TrayIcon; private System.Windows.Forms.ContextMenu MnuContext; private System.Windows.Forms.MenuItem MnuItem1; private System.Windows.Forms.MenuItem MnuItem2; private System.ComponentModel.IContainer components; public Form1() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.MnuContext = new System.Windows.Forms.ContextMenu(); this.MnuItem1 = new System.Windows.Forms.MenuItem(); this.MnuItem2 = new System.Windows.Forms.MenuItem(); // // TrayIcon // this.TrayIcon.ContextMenu = this.MnuContext; this.TrayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("TrayIcon.Icon"))); this.TrayIcon.Text = "NotifyMenu Tray"; this.TrayIcon.Visible = true; // // MnuContext // this.MnuContext.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.MnuItem1}); // // MnuItem1 // this.MnuItem1.Index = 0; this.MnuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.MnuItem2}); this.MnuItem1.Text = "Item 1"; this.MnuItem1.Popup += new System.EventHandler(this.MnuItem1_Popup); // // MnuItem2 // this.MnuItem2.Index = 0; this.MnuItem2.Text = "Item 2"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.ContextMenu = this.MnuContext; this.Name = "Form1"; this.Text = "Form1"; } #endregion [STAThread] static void Main() { Application.Run(new Form1()); } private void MnuItem1_Popup(obj
-
NotifyIcon and ContextMenu Bug ??When I associate a ContextMenu with a NotifyIcon, the MenuItems' Popup event doesn't fire, can anyone tell me if this is a bug inside the framework or am I doing something wrong ? I'm quite confused here... :confused:
-
Coder -vs- DeveloperI am deffinatly a Coder !!! I spend almost 95% of my time programming. Even if I have to develop a really huge algorithm, I still develop it while coding. Just put it in a small test program and make it bigger, better, faster, ... And YES, my employer knows the difference... I think I'm one of the lucky ones...
-
Multi-Select TreeViewDoes anyone know how to implement multi-selection inside a treeview the easy way. I probably have to design it myself, but it would be a great help of-course if someone knows where I can find some samples...
-
Intel C++ reported 37% faster than VC++ -
Intel C++ reported 37% faster than VC++It is probably designed to make specific usage of the P3 and P4 instruction set... The VC++ 6 compiler is designed to work the same on ALL processors... There is a processor pack available for VC++ 6, anyone tried this one ??? -= Forgive my English =-
-
Show/Hide a toolbarCan anyone tell me how to hide or show a toolbar on the MainFrame window from another thread. When I do something like: frmMain->m_canvasToolBar.ShowWindow(SW_SHOW); the function returns FALSE. And when I try to use: frmMain->ShowControlBar(&frmMain->m_canvasToolBar, TRUE, FALSE); the application crashes deep down inside the MFC core.
-
Modeless Dialogbox inside an MDI WindowCan anyone tell me how I can create a Modeless Dialogbox inside an MDI Window. If I create a dialog as modeless, using the Create function, and set the parent to the MainFrame MDI window, the dialog appears non-focused, as if it is disabled but you can still do everything with it. I found the solution once before, but can't recall it :(( Any help will be appreciated...
-
MDI Window ListWow, Thanks !!!! :-D I couldn't find this anywhere in the MSDN help files...