Caption won't change with Command1 click 
Author Message
 Caption won't change with Command1 click
Try putting
Label1.Refresh
DoEvents
after assigning caption.

Denis Gorshkov
Mobi-Sys Software Group Inc.
Have more than 1 VBP to compile? - Try Visual Make
www.mobi-sys.com


Quote:
> I have a problem in a small application I'm putting together. I've used
> a bit from a post I found here so I won't pretend I fully understand it.
> The problem is in the Command1 click section. When the program is run,
> in theory the Label1.caption should change to "searching..." but this
> doesn't happen. If I change the label1 to Form1 however, The form




Fri, 12 Apr 2002 03:00:00 GMT  
 Caption won't change with Command1 click
Right after you do a   label1.caption="something new"
 add  a line    label1.refresh    to make it show right away.

I suspect that the program changes it back to its normal state before the
system gets a chance to refresh it.

Good Luck


Quote:
> I have a problem in a small application I'm putting together. I've used
> a bit from a post I found here so I won't pretend I fully understand it.
> The problem is in the Command1 click section. When the program is run,
> in theory the Label1.caption should change to "searching..." but this
> doesn't happen. If I change the label1 to Form1 however, The form
> caption changes at the appropriate time. I can't figure it out. Hope
> someone else can. I'd say It's fairly simple and I'm just dense.

> Thanx in advance

> Raavin

> cut here

> VERSION 4.00
> Begin VB.Form Form1
>    Caption         =   "Subdirectory list"
>    ClientHeight    =   5940
>    ClientLeft      =   1140
>    ClientTop       =   1515
>    ClientWidth     =   6690
>    Height          =   6345
>    Left            =   1080
>    LinkTopic       =   "Form1"
>    ScaleHeight     =   5940
>    ScaleWidth      =   6690
>    Top             =   1170
>    Width           =   6810
>    Begin VB.DirListBox Dir1
>       Height          =   930
>       Left            =   120
>       TabIndex        =   3
>       Top             =   720
>       Width           =   2055
>    End
>    Begin VB.DriveListBox Drive1
>       Height          =   315
>       Left            =   120
>       TabIndex        =   2
>       Top             =   240
>       Width           =   2055
>    End
>    Begin VB.CommandButton Command1
>       Caption         =   "Command1"
>       Height          =   735
>       Left            =   3960
>       TabIndex        =   1
>       Top             =   5040
>       Width           =   2175
>    End
>    Begin VB.ListBox List1
>       Height          =   2400
>       Left            =   120
>       TabIndex        =   0
>       Top             =   2040
>       Width           =   6375
>    End
>    Begin VB.Label Label1
>       Caption         =   "Label1"
>       Height          =   615
>       Left            =   2640
>       TabIndex        =   4
>       Top             =   600
>       Width           =   2895
>    End
> End
> Attribute VB_Name = "Form1"
> Attribute VB_Creatable = False
> Attribute VB_Exposed = False
> Dim fso As New Scripting.FileSystemObject

> Private Sub Drive1_Change()

> Dir1.Path = Drive1.Drive

> End Sub

> Private Sub Command1_Click()

>     List1.Clear

>     Label1.Caption = "searching..."

>     Call DoCounts(fso.GetFolder(Dir1.Path))

> End Sub

> Sub DoCounts(ByRef fld As Folder)

>     List1.AddItem fld.Files.Count & vbTab & LCase$(fld.Path)

>     For Each fld In fld.SubFolders: Call DoCounts(fld): Next

> End Sub

> Private Sub Form_Load()
>     Dir1.Path = Drive1.Drive
> End Sub

> cut here



Sat, 13 Apr 2002 03:00:00 GMT  
 Caption won't change with Command1 click
I have a problem in a small application I'm putting together. I've used
a bit from a post I found here so I won't pretend I fully understand it.
The problem is in the Command1 click section. When the program is run,
in theory the Label1.caption should change to "searching..." but this
doesn't happen. If I change the label1 to Form1 however, The form
caption changes at the appropriate time. I can't figure it out. Hope
someone else can. I'd say It's fairly simple and I'm just dense.

Thanx in advance

Raavin

cut here

VERSION 4.00
Begin VB.Form Form1
   Caption         =   "Subdirectory list"
   ClientHeight    =   5940
   ClientLeft      =   1140
   ClientTop       =   1515
   ClientWidth     =   6690
   Height          =   6345
   Left            =   1080
   LinkTopic       =   "Form1"
   ScaleHeight     =   5940
   ScaleWidth      =   6690
   Top             =   1170
   Width           =   6810
   Begin VB.DirListBox Dir1
      Height          =   930
      Left            =   120
      TabIndex        =   3
      Top             =   720
      Width           =   2055
   End
   Begin VB.DriveListBox Drive1
      Height          =   315
      Left            =   120
      TabIndex        =   2
      Top             =   240
      Width           =   2055
   End
   Begin VB.CommandButton Command1
      Caption         =   "Command1"
      Height          =   735
      Left            =   3960
      TabIndex        =   1
      Top             =   5040
      Width           =   2175
   End
   Begin VB.ListBox List1
      Height          =   2400
      Left            =   120
      TabIndex        =   0
      Top             =   2040
      Width           =   6375
   End
   Begin VB.Label Label1
      Caption         =   "Label1"
      Height          =   615
      Left            =   2640
      TabIndex        =   4
      Top             =   600
      Width           =   2895
   End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Dim fso As New Scripting.FileSystemObject

Private Sub Drive1_Change()

Dir1.Path = Drive1.Drive

End Sub

Private Sub Command1_Click()

    List1.Clear

    Label1.Caption = "searching..."

    Call DoCounts(fso.GetFolder(Dir1.Path))

End Sub

Sub DoCounts(ByRef fld As Folder)

    List1.AddItem fld.Files.Count & vbTab & LCase$(fld.Path)

    For Each fld In fld.SubFolders: Call DoCounts(fld): Next

End Sub

Private Sub Form_Load()
    Dir1.Path = Drive1.Drive
End Sub

cut here



Sun, 14 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Label Caption Doesn't Change When Changed

2. Ignore mouse clicks that occur while Command1.Enabled=False

3. Label Caption won't Right Align Properly

4. Caption just won't go away!

5. Permanently change a text label's caption?

6. Changing Word's window caption

7. Change the color of form's caption (background and font color)

8. Triggering a 'select' change or click

9. Change MDIForm's Caption

10. Change FontS in Form's Caption

11. Changing MsgBox's Button caption

12. Click event won't fire on a user control

 

 
Powered by phpBB® Forum Software