Results 1 to 20 of 20

Thread: [RESOLVED] drop down textbox

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Resolved [RESOLVED] drop down textbox

    I would like to use a textbox in my application that has a dropdown feature to expand something if not exactly like the text property box in VS IDE. I first thought combo with dropdown width set wider but that's not it. Any one got any ideas where that input box came from?
    Life is about making some things happen, not waiting around for something to happen.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: drop down textbox

    you mean like a tooltip displaying the full text?

    Code:
    Public Class Form1
    
        Dim tt As New ToolTip
    
        Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
            tt.SetToolTip(TextBox1, TextBox1.Text)
        End Sub
    
    End Class

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: drop down textbox

    actually, I see what you mean now. that's a custom control only used in association with the PropertyGrid control.
    you could create your own user control which does the same thing...

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: drop down textbox

    Thanks guys for the input.

    I decide to make my own user control that acts like the text property of the VS IDE.

    I'm pretty close , only have one more thing to figure out then I post it share with everyone.
    Life is about making some things happen, not waiting around for something to happen.

  5. #5
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,758

    Re: drop down textbox

    are you referring to the AutoComplete Property of the textbox?
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: drop down textbox

    Quote Originally Posted by kebo View Post
    are you referring to the AutoComplete Property of the textbox?
    he's asking how to add a drop down textbox to a regular single line textbox, similar to the Text property in the vb ide properties propertygrid...

  7. #7
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,758

    Re: drop down textbox

    ok, for multiline. That's a wonderful thing that could be useful.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: drop down textbox

    Ok, here it is. Very simple control that expands when you hit the down arrow.
    The control is made up of a single line text box and a button. I used wingdings3 font for the arrow image on the button (the q char in wingdings3) as the text property.

    Toggle the multiline property on and off to expand to a predetermined size and return to original size on mouse leave.
    You can get the picture from my code below.

    Code:
    <ToolboxBitmap(GetType(TextBox))> Public Class DropDownTextBox
    
        Private CtrlWidth As Int32
    
        Private Sub DropDownTextBox_MouseHover(sender As Object, e As System.EventArgs) Handles txtDropDown.MouseHover
            btnDrop.Visible = True
        End Sub
    
        Private Sub DropDownTextBox_MouseLeave(sender As Object, e As System.EventArgs) Handles txtDropDown.MouseLeave
            txtDropDown.Multiline = False
            txtDropDown.SendToBack()
            txtDropDown.Width = CtrlWidth
        End Sub
    
        Private Sub DropDownTextBox_Resize(sender As Object, e As System.EventArgs) Handles txtDropDown.Resize
            Me.Height = txtDropDown.Height
            Me.Width = txtDropDown.Width
        End Sub
    
        Private Sub UserControl1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            CtrlWidth = txtDropDown.Width
            Me.Height = txtDropDown.Height
            Me.Width = txtDropDown.Width
        End Sub
    
        Private Sub btnDrop_Click(sender As Object, e As System.EventArgs) Handles btnDrop.Click
            txtDropDown.Multiline = True
            txtDropDown.Height = 100
            txtDropDown.Width = 250
            txtDropDown.BringToFront()
        End Sub
    End Class
    I attached the custom control in a zip file.

    It certainly could use some work, but for a simple expandable textbox I think I got it.
    Last edited by si_the_geek; Oct 29th, 2014 at 06:20 PM.
    Life is about making some things happen, not waiting around for something to happen.

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: drop down textbox

    I have removed your attachment to protect our members, because we have no way of knowing what an executable file actually does - which could include something malicious, such as if there is a virus on your computer.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: drop down textbox

    ok, I certainly did not mean to break any forum rules, so you as well as other forum member have my apologizes.

    But just a quick question; Can a member attach a solution as a zip. And if so, what about the bin and subsequently the .exe that's in there? If there isn't a quick answer then forget it as I could see this getting way out of control.
    Life is about making some things happen, not waiting around for something to happen.

  11. #11
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: drop down textbox

    Attaching the solution folder in a zip is fine... as long as you remove the Bin and Obj folders.

    The Bin and Obj folders aren't needed for sharing code, and if people want the compiled version they can compile it themselves (even using a free Express edition of VB).

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: drop down textbox

    I see . Thanks for the advice.

    I have one more question regarding my user control. And that is how to place it in my toolbox.

    I know how to "Choose Items" but that way will require the control to remain in a repository of sorts, I often clean up things and could accidentally delete that directory.

    So how do I place it where all the other components are located. As is GAC folder. I used gacutil/I tool, and it was installed into the GAC dir, but it still did not appear in the list of .NET components.

    I read that there was a link to the controls dir. in the registry that needed to be created? but then again I think I understood that using gacutil created it for me.

    Anyway is there a way to get it to the dir. where the other .Net components are and have it appear in the list of .Net components in VS
    Last edited by crater; Oct 30th, 2014 at 09:53 AM.
    Life is about making some things happen, not waiting around for something to happen.

  13. #13
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: drop down textbox

    You have to make a reference to it. Even if it's in the GAC, you still need to reference the assembly before it will show up. Once you reference it, then it will be available in your toolbox.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: drop down textbox

    ok my DropDownTextBox.dll is in: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\DropDownTextBox\v4.0_1.0.5415.36471__d21af7372fdbc839\Dro pDownTextBox.dll

    I made a key in the reg
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\DropDownTextBox

    Then added new string value: DropDownTextBox and added a value data of:

    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\DropDownTextBox\v4.0_1.0.5415.36471__d21af7372fdbc839\Dro pDownTextBox.dll

    I thought this was it according to :http://support.microsoft.com/kb/306149


    That didn't work, but then again I think now that might just add it to the "Add Reference" dialog box not the "Choose Tool box items"

    So I'm still lost.

    Can you help me make this reference so that my .dll will show up in the Choose Toolbox items dialog box?
    Last edited by crater; Oct 30th, 2014 at 11:22 AM.
    Life is about making some things happen, not waiting around for something to happen.

  15. #15
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: drop down textbox

    use Browse in Choose Toolbox Items:

    Name:  30-10-2014 16.31.59.jpg
Views: 147
Size:  44.3 KB

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: drop down textbox

    WOW that was hard.
    For some reason I convinced myself that wouldn't work so I never tried it.

    Thanks guys.
    Life is about making some things happen, not waiting around for something to happen.

  17. #17
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: [RESOLVED] drop down textbox

    You right click, Add reference... and find it... you should only need to browse (as .paul. is showing) if it isn't in the GAC. If you've GAC'd it correctly, the library will show up in that list. If it's not, then it's not in the GAC correctly, and you'll need to browse for it. The Choose Tolbox Items dialog allows you to select the items you have referenced to your toolbox and move them to another section... but by default it should show up somewhere in the General section at the very least.

    But before you can select it, you still need to set the reference for it in your project.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: [RESOLVED] drop down textbox

    TG,
    Ah ha, .Pauls way I thought got it, but in actuality it did not.
    I think it didn't install to the GAC correctly either cause it doesn't show in the references list either.

    I'm gonna gacutil/u to uninstall it and try again. Cause if i'm following, if it is in the GAC correctly it should at least show up in the reference list?

    I'll be back.
    Life is about making some things happen, not waiting around for something to happen.

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: [RESOLVED] drop down textbox

    I open explorer and goto C:\Windows\Microsoft.NET\assembly\GAC_MSIL and there is my folder "DropDownTextBox" open it and another folder "v4.0_1.0.5415.36471__d21af7372fdbc839" open it and there is my .dll
    So the whole path to GAC and .dll is
    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\DropDownTextBox\v4.0_1.0.5415.36471__d21af7372fdbc839

    So here is the text from CMD window, I think it says success. Yet it is not in "Add Reference" list or "Choose Toolbox Items" list.

    C:\Program Files\Microsoft Visual Studio 10.0\VC>gacutil/i C:\Users\MATT-C\Deskt
    op\DropDownTextBox.dll
    Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.1
    Copyright (c) Microsoft Corporation. All rights reserved.

    Assembly successfully added to the cache

    C:\Program Files\Microsoft Visual Studio 10.0\VC>

    Any ideas now?
    Life is about making some things happen, not waiting around for something to happen.

  20. #20
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: [RESOLVED] drop down textbox

    Forget the GAC and just add a reference to it... browse to where the dll is and select it. If it still then doesn't appear in the General section of your toolbox, then I'd question whether the assembly actually contains a control in it. Maybe use the ClassBrowser to view what is actually in it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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