Results 1 to 22 of 22

Thread: text box question - newbie

  1. #1

    Thread Starter
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197

    text box question - newbie

    I just havent used vb in a while, so its not me thats a n00b, just me question

    Now that that is clarified, I want to make a textbox act like a label (so you cant have a caret or select stuff).

    How do I do that simple thing?


    retired member. Thanks for everything

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    text1.enabled=false

  3. #3

    Thread Starter
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197
    doesnt that make it gray?

    how do I keep it black?

    I also need to make this respond to click events

    Last edited by markman; Jul 25th, 2002 at 04:09 PM.
    retired member. Thanks for everything

  4. #4

    Thread Starter
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197
    usually newbie questions are answered quickly

    or is this too tough for you????

    MWAHAHAHAHAHA
    retired member. Thanks for everything

  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Then skip the .enabled idea....
    and set the .Locked = true

    nevermind that doesn't work...

    Ah for pete's sake, just use a label.....

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try this
    VB Code:
    1. Private Declare Function HideCaret Lib "user32" ( ByVal hwnd As Long) As Long
    2.  
    3. Private Sub Text1_GotFocus()
    4. HideCaret Me.hwnd
    5. End Sub

  7. #7
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    That code looked golden Hack, thought to myself, wow, look at that elegance....

    doesn't work though... at least on XP ...

  8. #8
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Ah, but it does work....

    Me.Hwnd

    Needs to be Text1.Hwnd

    Forgive me master....

  9. #9
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Another alternative (can never have too many)...

    Put the textbox in a frame, and disable the frame.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  10. #10
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Originally posted by crptcblade
    Another alternative (can never have too many)...

    Put the textbox in a frame, and disable the frame.

    VB Code:
    1. vbQuote = """
    2.  
    3.  
    4. MyText = "Hello My Name Is " & vbQuote & "Ryan" & vbQuote


    Ooops... wrong question...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  11. #11
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752
    come on guys....what the big deal in this...

    textbox.enabled=false
    textbox.backcolor=vbgray
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  12. #12
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Originally posted by faisalkm
    come on guys....what the big deal in this...

    textbox.enabled=false
    textbox.backcolor=vbgray

    He doesn't want it grey, I'm guessing...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  13. #13
    Addicted Member
    Join Date
    Apr 2002
    Location
    Anywhere but here
    Posts
    161
    Wouldn't this work?

    Text1.locked = True



    I could be wrong
    -------------------------
    My name says it all!

  14. #14
    Addicted Member
    Join Date
    Apr 2002
    Location
    Anywhere but here
    Posts
    161
    OOPS.. never mind. He said so you cant select stuff
    -------------------------
    My name says it all!

  15. #15
    Fanatic Member Slaine's Avatar
    Join Date
    Jul 2002
    Posts
    641
    perhaps something like:

    VB Code:
    1. Private Sub txtBox_GotFocus()
    2.     SomeOtherControl.SetFocus
    3. End Sub
    Martin J Wallace (Slaine)

  16. #16
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Originally posted by Slaine
    perhaps something like:

    VB Code:
    1. Private Sub txtBox_GotFocus()
    2.     SomeOtherControl.SetFocus
    3. End Sub
    That's what I usually do.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  17. #17
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Label still the best way to go.....

  18. #18
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    Why are you people still answering if it was already answered?

  19. #19
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Originally posted by numtel
    Why are you people still answering if it was already answered?
    Overkill. It's called overkill.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  20. #20
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    Originally posted by rjlohan


    Overkill. It's called overkill.
    and you like this?

  21. #21
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    I'm still curious as to why a label can't be used?
    ....

  22. #22
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    yah a label saves memory too.

    make the borderstyle to 3d and the backcolor to white
    Remember, if someone's post was not helpful, you can always rate their post negatively .

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