V. useful outlook resource. http://www.slipstick.com/index.htm
Don_s
Posts
-
Outlook 2000 in C# (?) -
How to create browsable Help Documentation -
Mdi FormsIs this what you are after?
ManagerChild ChildForm = new fManagerChild(); ChildForm.MdiParent = this.Owner; ChildForm.Show();
-
Custom Control at Design TimeYou may have included some code that causes an infinite loop or the like at design time. Check your code for anything that relies on something that only exists at runtime. You can then do some logic arounbd this checking for whether it is designtime or runtime.
if(!this.DesignMode) { this.DoSomething(); }
Let me know if you need more info. -
Line Drawing (joining the dots!!)Have a look at:
Graphics.DrawPolygon();
-
cascading treeview checkbox changesvlusardi, There is no built in way to do this, however a simple function like the following should do what you want:
private void CheckChildNodes(TreeNode ParentNode) { foreach(TreeNode t in ParentNode.Nodes) { t.Checked = ParentNode.Checked; if(t.Nodes.Count > 0) { this.CheckChildNodes(t); } } }
-
XML object in C#I'm not sure exactly what you mean. However you may be able to solve your problem by simply reading your XML into a string &/or an XMLDocument object in the class.
//Read XML into a string (You will have to write getMyXml() method!!) string s = getMyXml(); //populate xml document XmlDocument x = new XmlDocument(); x.LoadXml(s);
I havn't tried either of these, so they may not do exactly what you expect!
-
Runtime type casting?Thomas, The
Convert.Equals()
method should do the trick for you here. As in the following:DataTable Table = new DataTable(); Table.Columns.Add(new DataColumn("Test1", System.Type.GetType("System.DateTime"))); Table.Columns.Add(new DataColumn("Test2", System.Type.GetType("System.DateTime"))); DateTime s = DateTime.Now; DataRow r = Table.NewRow(); r["Test1"] = s; r["Test2"] = s; Table.Rows.Add(r); bool s = Convert.Equals(Table.Rows[0][0], Table.Rows[0][1]); if(s) { return true; } else { return false; }
Hope this helps.
-
Overriding ToStringThere are 2 ways to do this, one of which you have already mentioned. Firstly you can use the
DisplayMember
property:this.checkedListBox1.DisplayMember = "Test"; // Where Test is the name of the property you would like to display
Alternatively, as you mentioned, override the ToString() method. Most list type controls use this as the default DisplayMember when it is not set explicitly:public override string ToString() { return this.Test; //Again, Where Test is the name of the property you would like to display }
I'm not sure why this did not work for you before. Both of these methods worked in a quick demo i wrote up.
-
MDI QuestionYou could do this in a couple of ways. If you are in full control of the form that is poping up, you can get the required information by capturing the OnClosing event of the logon form, add the event handler in your MDI parent's load event when you open the mdi child:
//initialise the logon form LogonForm f = new LogonForm(); //Set as child f.MdiParent = this; //Add event handler f.OnClosing += new EventHandler(this.Form1_Closing);
Having done this, write code along these lines to capture properties from the closing logon form:
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { LogonForm f = (LogonForm)sender; string Uname = f.Username; string Pword = f.Password; }
obviously you'll need to set up properties such as Username & Password in you logon form that are public. An other way may be to pass up a custom Logon class from the Parent to the child by reference, you can then populate it from the logon form and the information will be available to the parent. Let me know if you'd like me to elaborate on either of these methods.
-
Taskbar and soundsFor the flashing icon i think you will need two icons that you swap with each other at runtime (one could simply be transparent), using a timer. Let me know if you need me to elaborate.
-
disabling/greying a treeview nodeA simple solution that may do what you want is to simply set the
ForeColor
of the node you want greyed toColor.Gray
orColor.LightGray
. You can then handle theBeforeSelect
event of the treeview and check for the fore color, if it isColor.Gray
orColor.LightGray
, depending on which you choose, set the Cancel property of theTreeViewCancelEventArgs
to true:private void treeView1_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) { if(e.Node.ForeColor == Color.Gray) { e.Cancel = true; } }
Hope this is useful
-
Text Box on Desktop IconsI think you asked a similar question previously, which i answered for you earlier today. Please drop me an e-mail if you can't find it / need clarification
-
Growing a TextBox to fit textBenjamin, Try the following: Initialise a local field, default to the usual height of the textbox:
private int _InitialHeight = 20;
In the constructor of the derived class:this.Multiline = true; this._InitialHeight = this.Height;
Then override the OnTextChanged Method:protected override void OnTextChanged(System.EventArgs e) { //Get graphics System.Drawing.Graphics g = this.CreateGraphics(); //Get size System.Drawing.SizeF s = g.MeasureString(this.Text, this.Font); //Get the number of line (on top of the original 1), which need to be viewed int lines = Convert.ToInt32(s.Width) / this.Width; //Work out the height the control must be to view all lines int height = (lines * Convert.ToInt32(s.Height)) + this._InitialHeight; //Set height this.Height = height; }
I hope this does what you need. Let me know if you'd like elaboration on any point. Note that this does not take into account the user using the enter key.