Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2003, 10:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Ok! thanks from all friends to take ur time

Always:),
Hovik Melkomian.
 
Old August 16th, 2003, 12:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Hi Hovik

You can make your combobox toggle from read only to editable like this

this.testcombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
makes the combobox editable

this.testcombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
makes the combobox readonly

I realy hope this helps you.

Regards

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support
 
Old February 12th, 2004, 01:50 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try turning it into a text box....

Will not give away the farm but try something like this...

   public bool ReadOnlyOpt
      {
      get
         {
         return ReadOnlyActual;
         }
      set
         {
         if (value != ReadOnlyActual)
            {
            if (value)
               {
               base.Enabled = false;
               base.Visible = false;
               ctlTextBox = new TextBox ();
               ctlTextBox.Text = base.Text;
               ctlTextBox.ReadOnly = true;
               base.Parent.Controls.Add (ctlTextBox);
               ReadOnlyActual = true;
               }
            else
               {
               if (ctlTextBox != null)
                  {
                  base.Visible = true;
                  // The following two statements are necessary to prevent a .NET positioning bug
                  // that comes into play if the containing panel had been scrolled since
                  // the combobox had been hidden. The two statements must occur after
                  // the Visible flag is set true;
                  base.Left = ctlTextBox.Left;
                  base.Top = ctlTextBox.Top;
                  // end of special logic to prevent .NET bug.
                  base.Parent.Controls.Remove (ctlTextBox);
                  ctlTextBox = null;
                  }
               base.Enabled = true;
               base.Visible = true;
               ReadOnlyActual = false;
               }
            }
         }
      }
   public bool ReadOnlyActual = false;

   }

Brian Hanf
www.trailblz.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagridview & combobox column p2pmarit .NET Framework 2.0 1 July 31st, 2006 02:31 AM
ComboBox & ListBox usage venkikrao VB.NET 4 March 14th, 2006 07:50 AM
comboBox & ReadOnly melvik C# 2 October 29th, 2003 12:45 AM
ComboBox & related info melvik C# 2 July 5th, 2003 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.