Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Converting Textbox to Combobox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Resolved [RESOLVED] [2005] Converting Textbox to Combobox

    I want to convert a textbox on my form to Combobox so as to enable auto-complete feature in it.... but my textbox has lot of reference to it in my project... is there anyway of doing this which automatically changes all the reference to my textbox to combobox ?

  2. #2
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [2005] Converting Textbox to Combobox

    If you open the Designer file for the form, there will be two references to your textbox. One near the top, one near the bottom. If you change both of them from:

    System.Windows.Forms.Textbox

    to

    System.Windows.Forms.Combobox

    that should do it for you.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: [2005] Converting Textbox to Combobox

    Are you talking about the reference in the properties window of that textbox ?

  4. #4
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [2005] Converting Textbox to Combobox

    No, in the Solution Explorer, there's a button at the top called "Show All Files", click it.

    You'll see a [+] appear next to your form. Click it. You'll see two files, a Designer file and a Resource file. Every time you make a form, Visual Studio makes 3 files. These two are hidden because usually, only Visual Studio mucks around with them. When you drop a textbox on a form for example, Visual Studio writes the code to describe placing that box on the form behind the scenes. It does this in the Designer file.

    Open it. You'll see two references where TextBox1 is referenced as a System.Windows.Forms.Textbox. Change those two places to Combobox manually, and poof, your textbox becomes a combobox.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width