Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Border Property not responding to change

Posted on 2003-11-25
12
Medium Priority
?
253 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 750 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

722 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