Results 1 to 14 of 14

Thread: TextBox bug?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506

    TextBox bug?

    Add a textbox to a form, set it to multiline and disable it (enabled = false). Change the alignment during run-time using the code below.
    VB Code:
    1. Text1.Alignment = vbRightJustify
    On mine VB dies and I just updated it to SP5 thinking that would rectify the problem - it didn't. Applications compiled with this code also crash out.

    Just curious if anyone has come across this before and if they found a work-around, or not.

    -adehh

  2. #2
    Member
    Join Date
    Mar 2004
    Posts
    45
    Hi,

    I had this problem and I couldn't find a solution. I ended up just using the RichTextBox control instead. This does all that text box does and more.

    Robin

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    That is not an option, I tend to avoid dependancy files as much as possible and plus the textbox holds around a max of 12 characters which would be a waste of the richtext anyway.

    -adsehh

  4. #4
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Doesnt crash on me in debug or run mode from within VB. Also,

    Text1.Alignment = 1

    Also works fine for me.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    What version of VB are you running?

  6. #6
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    VB6, SP5

  7. #7
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    .....No crashes either here mate

  8. #8
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    I crashed on XP Pro (sp5) but not on Win98 (which does not have any service packs).

    Does the OS make a difference?

  9. #9
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    oh, and i am ussing Winmdws 98 SE

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    It's beginning to look like OS does make a difference. There's 2 cases now where 98 hasn't crashed, I'm running 2k and it crashed out both on SP5 and normal, that's VB enterprise.

    -adehh

  11. #11
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    I'm on XP Pro Sp1

  12. #12
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    I'm running WinXP Pro and I also get the same error. However, if I programmatically disable the textbox after setting the text alignment it works fine. Is that an option for you?
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  13. #13
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Locking the textbox rather than disabling it at design time also works. Another, perhaps better, option is to put the textbox in an invisible frame and disable the frame rather than textbox. If you choose the latter approach you can set the textbox's ForeColor to "Disabled Text" to make it look like it's disabled.

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    I ended up getting round it by using a label. I thought I needed use of the textheight function but recently found out that I don't so I'm not using the textbox anymore.

    Still interested as to why this bug only affects some people though.

    Cheers for all the replies, adehh.

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