Border Property not responding to change

Inside a Frame is a TextBox which I want to change the border property.  When I change the property
with  
TxtName.BorderStyle = 0  
it does not respond.  I assume something like the form, the frame, etc.
has to be refreshed?  No errors occur, but the border does not change.
dastaubAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rekhasriCommented:
In Which event are u trying to call this?
0
dbrckoviCommented:
Hi!

Have you tried Refresh Method?

    Text1.BorderStyle = 0
    Text1.Refresh
    Frame1.Refresh
    Form1.Refresh


0
dbrckoviCommented:
Try setting BorderStyle property to 0 in property sheet (design view), and then in form_Load event set it back to 1.
Now it should work even without Refreshing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

EDDYKTCommented:
?

I've no problem

Put textbox inside the frame


Private Sub Command1_Click()
TxtName.BorderStyle = IIf(TxtName.BorderStyle = 0, 1, 0)
End Sub
0
dbrckoviCommented:
EDDYKT

The problem occurs if a textbox's appearence is flat, and if it's initial BorderStyle is None.
At least that's a condition under which it has happened to me.
0
EDDYKTCommented:
It works in both cases

?->
0
MatrixFreakCommented:
dastaub,
     
        If the textbox settings are not as dbrckovi expained, then there are 2 other possible reasons that the textbox would behave that way. (1)The textbox name you typed in code does not match the original name you gave to the textbox visually (properties window) or (2) you accidentally created an array of textboxes by typing a number 0 in the index property of the properties window for the textbox. Reason (2) would change the textbox name from 'TxtName' to 'TxtName(0)' (or whatever number you might have entered) and that would cause the textbox to stop responding.  Goodluck!
0
MatrixFreakCommented:
I just realized you said 'No errors occur'.  The reasons i gave would raise errors.  Unless you entered 'On Error Resume Next' in your code.  In that case the errors would go by unnoticed.
0
EDDYKTCommented:
Create a new project and try
0
MatrixFreakCommented:
EDDYKT,

        If you were asking me to 'Create a new project and try', i did.  It created no errors when the 'On Error Resume Next' was put the Form_Load, subroutine, or a command button.  However, errors did get raised when i realized that i forgot my installation does not automatically insert 'Option Explicit' in a new project and decided to type it in.  The 'Option Explicit' detected that there was a typo and said 'variable not defined'.  Dastaub might have the system setup to not Require Variable Declaration.  No 'Option Explicit' combined with 'On Error Resume Next' would create no errors.  Dbrckovis' reason is most likely, but mine is still a possibility.
0
dbrckoviCommented:
This example should show what happens.

Create 4 textboxes, and two command buttons

Set appearance of textbox3 and textbox4 to 0
Set BorderStyle of textbox2 and textbox4 to 0

Paste this code to command buttons:
----------------------------------------------
Private Sub Command1_Click()
    Text1.BorderStyle = 1
    Text2.BorderStyle = 1
    Text3.BorderStyle = 1
    Text4.BorderStyle = 1
End Sub

Private Sub Command2_Click()
    Text1.BorderStyle = 0
    Text2.BorderStyle = 0
    Text3.BorderStyle = 0
    Text4.BorderStyle = 0
End Sub
-----------------------------------------------
Try clicking buttons.

Everything works fine except textbox3.

When textbox3.BorderStyle is 0 then it has black line around, and when it is set to 1 it gets a thicker black line.

I think this is a bug, and maybe it is fixed in some service pack.     My version of Visual Basic is 8176,    VBA: Retail 6.0.8169,    Forms3: 2.01
If you, EDDYKT, MatrixFreak, don't experience the same problem, and have new versions, then it's most likely a bug.    ( BTW I have never installed any servece pack )
0
dastaubAuthor Commented:
the problem appeared to dissappear when the property is set at design time to no border, then at run time I was able
to turn the borders off and on without any problem, as long as the borders are set to "0" at design time.
thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.