Status Bar + size

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
Hi all

Am after creating a windows form that has a status bar at the bottem. Now the text of the status bar should change when particular event occure, however it is instead throwing an error that tells me that the amount of text was too long (cannot be over 64 characters long)
Code:
ystem.ArgumentException: Text length must be less than 64 characters long.
   at System.Windows.Forms.NotifyIcon.set_Text(String value)
   at FileWatch.frmWatch.SetNotifyIcon(MonitorState CurrentState, String Text) in C:\Project\FileWatch\FileWatch\frmWatch.vb:line 334
   at FileWatch.frmWatch.fsw_Events(Object sender, FileSystemEventArgs e) in C:\Project\FileWatch\FileWatch\frmWatch.vb:line 299

Here is the method that puts the text into the status bar...
Code:
Private Sub fsw_Events(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed, FileSystemWatcher1.Created, FileSystemWatcher1.Deleted

        Dim sChange As String
        Select Case e.ChangeType
            Case WatcherChangeTypes.Changed
                sChange = "File Changed: " & e.FullPath()
            Case WatcherChangeTypes.Created
                sChange = "File Created: " & e.FullPath()
            Case WatcherChangeTypes.Deleted
                sChange = "File Deleted: " & e.FullPath()
            Case WatcherChangeTypes.Renamed
                sChange = "File Renamed: " & e.FullPath()
        End Select
        Beep()
        SetNotifyIcon(MonitorState.msFileChanged, sChange)

    End Sub

Would appreciate any suggestions on how to solve this problem.

Mike55
 
Why don't you add a panel to the statusbar and just set '.Text' field of that directly. I have had no problems with text length using that.
 
Back
Top