I've been looking at how to use BalloonTipText, and I found this small section of code:
NotifyIcon1.BalloonTipTitle =
"Balloon Tip Title"NotifyIcon1.BalloonTipText =
"Balloon Tip Text."NotifyIcon1.BalloonTipIcon = ToolTipIcon.Error
That isn't working for me though, in the test app I made to try it out. I put it in the NotifyIcon1_Click event and nothing showed up. I'd really like to be able to display something when the user hovers over the notify icon too, and I couldn't find a hover over event. Also, can I use a variable for the text in the balloon tip Any help would be appreciated.

BalloonTipText on NotifyIcon1 Hover over?
KavitaRavi
Venksys
This is why I suggested you put a BreakPoint in your code, that way you can step thru it (even if there is no actual error raised) and see in the values for all your variables and maybe trace where the problem is. And you will know if the messages are being sent to the Notify Icon's BalloonToolTip that way.
Otherwise, as I mentioned earlier, it may be a problem with your installation, OS version, or a spyware program blocking messages to the Notify Icon.
james
aka:Trucker
Pavel Cristian Gabriel
This works for me, for getting weather (ignore the HTML stuff, I haven't bothered to strip that out yet) . Add a Button to a form, a Textbox, a Web Browser Control and a NotifyIcon. Then the following code:
Public
Class Form1 Dim mytxt As String Private Sub btnGetWeather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetWeather.Click Dim sr As IO.StreamReader Dim wc As New System.Net.WebClient Dim strUrl As String Dim strOut As String = ""strUrl =
String.Format("http://xml.weather.yahoo.com/forecastrss p={0}", txtZip.Text) Trysr =
New IO.StreamReader(wc.OpenRead(strUrl)) Dim strHtml As String = sr.ReadToEnd Dim x As Integer = strHtml.IndexOf("<img src") Dim y As Integer = strHtml.IndexOf(")<br/>")strOut = strHtml.Substring(x, y - x + 6)
sr.Close()
CatchstrOut =
"<h1>Error getting weather</h1>" FinallyWebBrowser1.DocumentText = strOut
End Trymytxt = strOut.ToString
' Me.NotifyIcon1.BalloonTipText = strOut.ToString ' Me.NotifyIcon1.ShowBalloonTip(100) End Sub Private Sub NotifyIcon1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseMove Me.NotifyIcon1.BalloonTipText = mytxt.ToString Me.NotifyIcon1.ShowBalloonTip(100) End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info Me.NotifyIcon1.BalloonTipTitle = "WEATHER ALERT!" End SubEnd
ClassEnter a zip code in the Textbox and click on BtnGetWeather and it will retreive Yahoo's weather forcast. Hover your mouse pointer over the Notify Icon in the system Tray, and the Balloon Tooltip will popup with the weather forcast, along with all the other stuff it cannot display correctly, but, you get the idea here.
james
aka:Trucker
Slugo
Put it in your Form's Deactivated Event. And add this:
NotifyIcon1.ShowTooltip(1)
That way, when you minimize the form ( clicking the Minus sign in the upper right corner of the form) it will show the tooltip text at the Notify Icon you added to your project. Also, if you look in the Notify Icon's Properties you will see a TEXT property, this is where you add the text for when the mouse pointer is over the Notify Icon in the System Tray. And you can use a variable to hold your string for your Notify Icon's Text Property.
Dim nifIconTxt as String
NotifyIcon1.Text = nifIcon
james
aka:Trucker
chrisfewtrell
That is strange!! I cannot imagine why it wouldn't work. You are using VB2005 Express Edition aren't you Your code example sure looks that way to me. Do you get the weather when you click the Get Weather button ( after putting in a zip code in txtZip) I even did this to get the weather info to show up when the weather page completed loading:
Private
Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Me.NotifyIcon1.BalloonTipText = mytxt.ToString Me.NotifyIcon1.ShowBalloonTip(100) End SubEnter a zip, click Get Weather, and in a moment............the BalloonTooltip pops up and has the weather in it. Pretty cool. I cannot imagine why this isn't working for you.
james
aka:Trucker
Jim Carnicelli
xcao
Thanks. I tried that and it didn't work. I know about setting the text property for a notify icon and that it shows that text, but I have a weather program, and I'd like it to show the weather for a specific area, which my program gets, whenever the mouse hovers over the icon in the system tray. Thanks for any help. Here's what I have.
Public
Class Form1 Dim mytext As String = "This is a line of text" Private Sub Form1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DeactivateNotifyIcon1.BalloonTipTitle =
"Balloon Tip Title"NotifyIcon1.BalloonTipText = mytext
NotifyIcon1.ShowBalloonTip(1000)
End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End SubEnd
ClassFreddie70
No problem! Other than an OS specific problem or VB2005 install issue, I cannot see what could be going on here. Unless, you are running an anti-spyware program that thinks the messages between the app and the Notify Icon are suspect in some way. You can try an put a Breakpoint in the Notify Icon's Mouse_Move event or even send the output to the Output Window to see if the message is actually being passed to the Notify Icon.
Console.WriteLine(mytxt.ToString)
then, when you exit out of the program the data should show up in the Output Window.
( you may have to go to VIEW: OTHER WINDOWS: OUTPUT WINDOW to see it.)
james
aka:Trucker
LIKEKE1
I'm sure you did this, but, just in case, did you assign an Icon to the Notify Icon on it's property page The code you posted is basicly the same thing that I did here as a test and it works fine. It appears that the BalloonToolTip only shows up when it is triggered by some event, like Deactivating the form. You could have your application grab your weather info on a timer, and when the timer reaches the point that you want it to ( the time it checks for a weather update) you could grab the data as a string and assign it to the BalloonToolTip. Then, it should pop up the Balloon Tooltip with the info. Other than that, you may have to roll your own. (just an idea)
james
aka:Trucker
KimFreeborn
I don't see why this isn't working for you. Maybe, it is OS specific. I am using Windows XP and it works fine here. You may have to do a reinstall of VB2005 EE to fix the problem. As for the error you mentioned when there is no weather to display and you move the mouse pointer over the Notify Icon, it's a simple fix. I had slapped the code I posted together to test the problem you were having. All is needed it to check to see if the Web Browser's Document is empty, like so:
Private
Sub NotifyIcon1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseMove If Not WebBrowser1.Document Is Nothing Then Me.NotifyIcon1.BalloonTipText = mytxt.ToString Me.NotifyIcon1.ShowBalloonTip(100) Else Exit Sub End If End SubNow, if you move the pointer over the Notify Icon before clicking Get Weather button, nothing will happen (other than a popup with the Notify Icon's regular Tooltip Text).
But, when you enter the zip code and click get weather, the Balloon Tip will pop up when the document is completed (loaded into the web browser). Or when you hold the mouse pointer over it.
james
aka:Trucker
Victor Havin
Julio Molinero
Giving trucker the exact error would be helpful. There isn't much definitive information in, "it didn't work".
oman
Sat-Bangalore
In case you're wondering, I just ran your code again, and it works. I don't know what the problem was. It could have just been some problem with my system. I've been having unrelated problems with this computer and I'm now running Windows XP Professional x64 trial version. The format could have gotten rid of whatever the problem was. This is great because I can now have the weather show up for the user's favorite zip code when they have my app minimized. Is there a way to have it automatically go away so I don't have to click the X to close the balloon I thought that was what the number was for in this line:
Me
.NotifyIcon1.ShowBalloonTip(100)I thought that was the timeout in milliseconds. Maybe not.