Solved

Border Property not responding to change

Posted on 2003-11-25
12
252 Views
Last Modified: 2010-05-03
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.
0
Comment
Question by:dastaub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
12 Comments
 
LVL 2

Expert Comment

by:rekhasri
ID: 9822966
In Which event are u trying to call this?
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9822992
Hi!

Have you tried Refresh Method?

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


0
 
LVL 11

Accepted Solution

by:
dbrckovi earned 250 total points
ID: 9823021
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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 26

Expert Comment

by:EDDYKT
ID: 9824272
?

I've no problem

Put textbox inside the frame


Private Sub Command1_Click()
TxtName.BorderStyle = IIf(TxtName.BorderStyle = 0, 1, 0)
End Sub
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9824356
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9825222
It works in both cases

?->
0
 
LVL 1

Expert Comment

by:MatrixFreak
ID: 9826228
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
 
LVL 1

Expert Comment

by:MatrixFreak
ID: 9826302
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9826404
Create a new project and try
0
 
LVL 1

Expert Comment

by:MatrixFreak
ID: 9826599
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
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9830118
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
 

Author Comment

by:dastaub
ID: 9846796
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question