notify icon
hej. skal til at skrive et program i vb .netog det er lidt lang tid siden sidst, så det kan godt være at det er et rimelig lige til problem jeg har...
jeg har en component class der ser sådan ud:
Imports System.Threading
Public Class main
Inherits System.ComponentModel.Component
#Region " Component Designer generated code "
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Component overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
Friend WithEvents noty As System.Windows.Forms.NotifyIcon
Friend WithEvents menu As System.Windows.Forms.ContextMenu
Friend WithEvents menuitem1 As System.Windows.Forms.MenuItem
Friend WithEvents menuitem2 As System.Windows.Forms.MenuItem
Friend WithEvents menuitem3 As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(main))
Me.noty = New System.Windows.Forms.NotifyIcon(Me.components)
Me.menu = New System.Windows.Forms.ContextMenu
Me.menuitem1 = New MenuItem
Me.menuitem2 = New MenuItem
Me.menuitem3 = New MenuItem
'
'noty
'
Me.noty.ContextMenu = Me.menu
Me.noty.Icon = CType(resources.GetObject("noty.Icon"), System.Drawing.Icon)
Me.noty.Text = "sms server"
Me.noty.Visible = True
'
'menu
'
Me.menu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuitem1, Me.menuitem2, Me.menuitem3})
'
'menuitem
'
menuitem1.Text = "Setting"
menuitem2.Text = "Status"
menuitem3.Text = "Exit"
menuitem1.Index = 0
menuitem2.Index = 1
menuitem3.Index = 2
'
End Sub
#End Region
Private Sub menuitem3_exit(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuitem3.Click
Me.Dispose()
End
End Sub
Public Shared Sub main()
keepalive()
End Sub
Public Shared Sub keepalive()
Do While True
System.Threading.Thread.Sleep(50)
Application.DoEvents()
Loop
End Sub
End Class
problemet er at den ikke viser notify iconet og kan ikke lige finde ud af hvad der er galt....
Tak på forhånd
M.V.H
Nicklas