Hi
I have a rather unique problem with a simple user control. It is created within the project.
Every so often an error appears wanting to change from
to
I accept the change, then later on it changes back.... repeat this every 10 minutes or so and it becomes highly annoying! lol
Does anybody have any ideas?
Thanks
Here is the full Code.
Thanks again.
I have a rather unique problem with a simple user control. It is created within the project.
Every so often an error appears wanting to change from
VB.NET:
Me.HeaderPanel1 = New MarketingDB.HeaderPanel
VB.NET:
Me.HeaderPanel1 = New Global.MarketingDB.HeaderPanel
I accept the change, then later on it changes back.... repeat this every 10 minutes or so and it becomes highly annoying! lol
Does anybody have any ideas?
Thanks
Here is the full Code.
VB.NET:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class HeaderPanel
Inherits System.Windows.Forms.UserControl
'UserControl overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.lblUser = New System.Windows.Forms.Label
Me.Label12 = New System.Windows.Forms.Label
Me.lblDate = New System.Windows.Forms.Label
Me.lblErrorMsg = New System.Windows.Forms.Label
Me.tmrTime = New System.Windows.Forms.Timer(Me.components)
Me.SuspendLayout()
'
'lblUser
'
Me.lblUser.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lblUser.AutoSize = True
Me.lblUser.Location = New System.Drawing.Point(794, 6)
Me.lblUser.Name = "lblUser"
Me.lblUser.Size = New System.Drawing.Size(55, 13)
Me.lblUser.TabIndex = 0
Me.lblUser.Text = "Username"
'
'Label12
'
Me.Label12.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label12.AutoSize = True
Me.Label12.Location = New System.Drawing.Point(756, 6)
Me.Label12.Name = "Label12"
Me.Label12.Size = New System.Drawing.Size(32, 13)
Me.Label12.TabIndex = 0
Me.Label12.Text = "User:"
'
'lblDate
'
Me.lblDate.AutoSize = True
Me.lblDate.Location = New System.Drawing.Point(3, 6)
Me.lblDate.Name = "lblDate"
Me.lblDate.Size = New System.Drawing.Size(113, 13)
Me.lblDate.TabIndex = 0
Me.lblDate.Text = "31/01/2008 12:34:56"
'
'lblErrorMsg
'
Me.lblErrorMsg.AutoSize = True
Me.lblErrorMsg.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblErrorMsg.ForeColor = System.Drawing.Color.Red
Me.lblErrorMsg.Location = New System.Drawing.Point(156, 5)
Me.lblErrorMsg.Name = "lblErrorMsg"
Me.lblErrorMsg.Size = New System.Drawing.Size(98, 16)
Me.lblErrorMsg.TabIndex = 1
Me.lblErrorMsg.Text = "Error Message"
Me.lblErrorMsg.Visible = False
'
'tmrTime
'
Me.tmrTime.Enabled = True
Me.tmrTime.Interval = 1000
'
'HeaderPanel
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Transparent
Me.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Controls.Add(Me.lblErrorMsg)
Me.Controls.Add(Me.lblUser)
Me.Controls.Add(Me.Label12)
Me.Controls.Add(Me.lblDate)
Me.Name = "HeaderPanel"
Me.Size = New System.Drawing.Size(866, 26)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents lblUser As System.Windows.Forms.Label
Friend WithEvents Label12 As System.Windows.Forms.Label
Friend WithEvents lblDate As System.Windows.Forms.Label
Friend WithEvents lblErrorMsg As System.Windows.Forms.Label
Friend WithEvents tmrTime As System.Windows.Forms.Timer
End Class
VB.NET:
Imports System.Data.SqlClient
Public Class HeaderPanel
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.Dock = DockStyle.Top
lblUser.Visible = False
Try
Dim Conn As New SqlConnection(My.Settings.Conn)
Dim cm As New SqlCommand("select suser_sname()", Conn)
cm.CommandType = CommandType.Text
Conn.Open()
lblUser.Text = cm.ExecuteScalar
lblUser.Text = lblUser.Text.Substring(4)
Conn.Close()
Catch ex As Exception
lblUser.Text = "Error"
End Try
If lblUser.Text.Length > 0 Then lblUser.Visible = True Else lblUser.Visible = False
End Sub
Dim _Username As String = ""
Public Property Username() As String
Get
Return _Username
End Get
Set(ByVal value As String)
_Username = value
If value.Length > 0 Then lblUser.Visible = True Else lblUser.Visible = False
End Set
End Property
Private Sub tmrTime_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTime.Tick
lblDate.Text = Date.Now
End Sub
Dim _ShowErrorMsg As Boolean
Public Property ShowErrorMsg() As Boolean
Get
Return _ShowErrorMsg
End Get
Set(ByVal value As Boolean)
_ShowErrorMsg = value
End Set
End Property
Dim _ErrorMsg As String
Public Property ErrorMsg() As String
Get
Return _ErrorMsg
End Get
Set(ByVal value As String)
_ErrorMsg = value
lblErrorMsg.Text = value
lblErrorMsg.Visible = True
ShowErrorMsg = True
End Set
End Property
End Class
Thanks again.