|
-
Mar 4th, 2008, 09:10 AM
#1
Thread Starter
Hyperactive Member
[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 ?
-
Mar 4th, 2008, 09:15 AM
#2
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.
-
Mar 4th, 2008, 09:27 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] Converting Textbox to Combobox
Are you talking about the reference in the properties window of that textbox ?
-
Mar 4th, 2008, 09:33 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|