Why does my text continue to stand out?

I am making a “toast” in vb.net, and whenever it pops up, all the text in the body text field ALWAYS stands out ... how can I remove the selection programmatically?

Thank!

Here is the code that seems to automatically highlight:

Dim i As Integer toast.HeaderL.Text = headertext toast.BodyL.Text = contenttext toast.Show() toast.Opacity = 0 i = 0 While i < 100 toast.SetDesktopLocation(My.Computer.Screen.WorkingArea.Right - toast.Width, My.Computer.Screen.WorkingArea.Bottom - ((toast.Height / 100) * i)) toast.Opacity += 0.01 wait(7) i += 1 End While wait(4000) toast.Opacity = 1 i = 0 While i < 100 toast.SetDesktopLocation(toast.Location.X, toast.Location.Y + toast.Height / 100) toast.Opacity -= 0.01 wait(7) i += 1 End While toast.Close() 

Always, the text inside the BodyL (which is a text field) is highlighted by itself. I tried adding toast.Focus () at some points, but this did not work.

toast is the name of the form.

+1
highlighting text winforms toast
Aug 28 '09 at 3:15
source share
1 answer

This is more of a guess, but you can try adding the following line after assigning BodyL text:

 toast.BodyL.Select(toast.BodyL.Text.Length, 0) 

Another idea is to add some other control to the form of the toast (for example, Panel ), which can receive input focus without displaying (it can be made very small or even moved outside the visible part of the form), and make sure that this element The control gets focus when displaying the shape of the toast.

+3
Aug 28 '09 at 19:07
source share



All Articles