Results 1 to 4 of 4

Thread: ToolStripStatusLabel

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Location
    Belgium
    Posts
    98

    ToolStripStatusLabel

    Hi all,

    Me...again

    My next problem is the following one...I have a ToolStripStatusLabel and it is set to ImageAndText. But I want to change the image at runtime.
    Depending whether the data is up-to-date or not.
    So if the data is up-to-date I want to see a green V , if not a ! sign
    At this moment I have this, but it doesn't seem to work
    Code:
      Select Case diffday
                Case Is < 0
                    Main.DAFIF_txt.ForeColor = Color.Red
                    Main.DAFIF_txt.Text = "DAFIF Outdated"
                    Main.DAFIF_txt.Image = Image.FromFile(domain_path & "Grafix\DAFIF_NOK.png")
                Case Else
                    Main.DAFIF_txt.ForeColor = Color.Green
                    Main.DAFIF_txt.Text = "DAFIF valid till " & DateTime.FromOADate(enter_datum)
                    Main.DAFIF_txt.Image = Image.FromFile(domain_path & "Grafix\DAFIF_OK.png")
            End Select
    Thanks in advance

  2. #2
    Lively Member
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    115

    Re: ToolStripStatusLabel

    Can you confirm that your domain_path ends with a "\". I had a similar problem and that was the culprit.
    Regards
    Colin

    If my comments helped please remember to add to my reputation using Rate This Post.

    If your problem has been resolved please mark the thread resolved using the "Mark Thread Resolved" link in thread tools.

    CodeBank Submissions: 1) WebBrowser - Delete cookies etc 2) Import My.Settings from previous build version

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ToolStripStatusLabel

    Quote Originally Posted by wearmc View Post
    Can you confirm that your domain_path ends with a "\". I had a similar problem and that was the culprit.
    If you use the Path.Combine method then you don't have to worry about that because it will work either way. This:
    vb.net Code:
    1. Main.DAFIF_txt.Image = Image.FromFile(IO.Path.Combine(domain_path, "Grafix\DAFIF_NOK.png"))
    will work whether 'domain_path' ends with a slash or not.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ToolStripStatusLabel

    Quote Originally Posted by Geemuse View Post
    Hi all,

    Me...again

    My next problem is the following one...I have a ToolStripStatusLabel and it is set to ImageAndText. But I want to change the image at runtime.
    Depending whether the data is up-to-date or not.
    So if the data is up-to-date I want to see a green V , if not a ! sign
    At this moment I have this, but it doesn't seem to work
    Code:
      Select Case diffday
                Case Is < 0
                    Main.DAFIF_txt.ForeColor = Color.Red
                    Main.DAFIF_txt.Text = "DAFIF Outdated"
                    Main.DAFIF_txt.Image = Image.FromFile(domain_path & "Grafix\DAFIF_NOK.png")
                Case Else
                    Main.DAFIF_txt.ForeColor = Color.Green
                    Main.DAFIF_txt.Text = "DAFIF valid till " & DateTime.FromOADate(enter_datum)
                    Main.DAFIF_txt.Image = Image.FromFile(domain_path & "Grafix\DAFIF_OK.png")
            End Select
    Thanks in advance
    Define "doesn't seem to work". Is there an error message? If so, that's information relevant to our solving the problem. If there isn't, exactly what does happen?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width