Auto completion in Dos Prompt (cmd.exe)

by Damiaan Peeters 27. February 2008 14:14
It can be very annoying if the "auto completion" method not not available in the Windows XP Dos Prompt (read: command prompt).

If you type: cmd /f  it will be activated for the current session.  If you want to activate it on a pc (or change the key which is by default TAB), then visit the link.

How To Use Automatic Completion with a Command Prompt in Windows XP

Commonality - VS2008 Color Schemes

by Damiaan Peeters 21. February 2008 15:43

Ever wanted to change the VS2008 Color Schemes? 

Tomas Restrepo posted VS2008 Color Schemes .

Microsoft Office Documents file formats released

by Damiaan Peeters 20. February 2008 12:40

What a relief, last week, Microsoft published the binary file formats for Office

Well not exactly a relief because the specs are difficult, very difficult.  Joel Spolsky has a interesting vision on this topic. 
Go read his article "Why are the Microsoft Office file formats so complicated? (And some workarounds)".

 

How to extend the TabControl in Windows Forms

by Damiaan Peeters 19. February 2008 15:35

Short post, much code.

In this post I want to show how the TabControl can be extended.  How you can Hide and show a TabPage.

You can use the control like this:

 

if (currentProduct.Product_Compound)
{
tabProduct.ShowTabPage(tabProductCompound);
}
else
{
tabProduct.HideTabPage(tabProductCompound);
}

 

 

[more]

    /// <summary>
    /// A new tabControl
    /// </summary>
    public class TabControl : System.Windows.Forms.TabControl
    {
        /// <summary>
        /// Hides the tab page.
        /// </summary>
        /// <param name="tp">The TabPage</param>
        public void HideTabPage(TabPage tp)
        {
            if (this.TabPages.Contains(tp))
                this.TabPages.Remove(tp);
        }
        /// <summary>
        /// Shows the tab page.
        /// </summary>
        /// <param name="tp">The TabPage</param>
        public void ShowTabPage(TabPage tp)
        {
            ShowTabPage(tp, this.TabPages.Count);
        }
        /// <summary>
        /// Shows the tab page.
        /// </summary>
        /// <param name="tp">The TabPage</param>
        /// <param name="index">The index.</param>
        public void ShowTabPage(TabPage tp, int index)
        {
            if (this.TabPages.Contains(tp)) return;
            InsertTabPage(tp, index);
        }
        /// <summary>
        /// Inserts the tab page.
        /// </summary>
        /// <param name="tabpage">The tabpage.</param>
        /// <param name="index">The index.</param>
        public void InsertTabPage(TabPage tabpage, int index)
        {
            if (index < 0 || index > this.TabCount)
                throw new ArgumentException("Index out of Range.");
            this.TabPages.Add(tabpage);
            if (index < this.TabCount - 1)
                do
                {
                    SwapTabPages(tabpage, (this.TabPages[this.TabPages.IndexOf(tabpage) - 1]));
                }
                while (this.TabPages.IndexOf(tabpage) != index);
            this.SelectedTab = tabpage;
        }
        /// <summary>
        /// Swaps the tab pages.
        /// </summary>
        /// <param name="tp1">The TabPage1.</param>
        /// <param name="tp2">The TabPage2.</param>
        public void SwapTabPages(TabPage tp1, TabPage tp2)
        {
            if (this.TabPages.Contains(tp1) == false || this.TabPages.Contains(tp2) == false)
                throw new ArgumentException("TabPages must be in the TabControls TabPageCollection.");

            int Index1 = this.TabPages.IndexOf(tp1);
            int Index2 = this.TabPages.IndexOf(tp2);
            this.TabPages[Index1] = tp2;
            this.TabPages[Index2] = tp1;

            //Uncomment the following section to overcome bugs in the Compact Framework
            //this.SelectedIndex = this.SelectedIndex;
            //string tp1Text, tp2Text;
            //tp1Text = tp1.Text;
            //tp2Text = tp2.Text;
            //tp1.Text=tp2Text;
            //tp2.Text=tp1Text;

        }
    }

Who.I.am

Certified Umbraco, .net and Azure developer, seo lover. Magician in my spare time.

Month List