Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Don_s

@Don_s
About
Posts
14
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Outlook 2000 in C# (?)
    D Don_s

    V. useful outlook resource. http://www.slipstick.com/index.htm

    C# csharp c++ help question

  • How to create browsable Help Documentation
    D Don_s

    http://ndoc.sourceforge.net/

    C# question csharp visual-studio help tutorial

  • Mdi Forms
    D Don_s

    Is this what you are after?ManagerChild ChildForm = new fManagerChild(); ChildForm.MdiParent = this.Owner; ChildForm.Show();

    C# question

  • Custom Control at Design Time
    D Don_s

    You 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.

    C# design question

  • Line Drawing (joining the dots!!)
    D Don_s

    Have a look at: Graphics.DrawPolygon();

    C# graphics data-structures regex question

  • cascading treeview checkbox changes
    D Don_s

    vlusardi, 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);
    		}
    	}
    }
    
    C# csharp algorithms help tutorial

  • XML object in C#
    D Don_s

    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!

    C# question csharp xml

  • Runtime type casting?
    D Don_s

    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.

    C# question tutorial

  • Overriding ToString
    D Don_s

    There 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.

    C#

  • MDI Question
    D Don_s

    You 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.

    C# tutorial question

  • Taskbar and sounds
    D Don_s

    For 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.

    C# csharp adobe

  • disabling/greying a treeview node
    D Don_s

    A simple solution that may do what you want is to simply set the ForeColor of the node you want greyed to Color.Gray or Color.LightGray. You can then handle the BeforeSelect event of the treeview and check for the fore color, if it is Color.Gray or Color.LightGray, depending on which you choose, set the Cancel property of the TreeViewCancelEventArgs 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

    C# csharp question

  • Text Box on Desktop Icons
    D Don_s

    I 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

    C# help tutorial

  • Growing a TextBox to fit text
    D Don_s

    Benjamin, 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.

    C# csharp help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups