.NET Forum / Windows Forms / WinForm General / September 2005
Problem Solution Explorer and forms
|
|
Thread rating:  |
larzeb - 11 Aug 2005 20:21 GMT I just noticed a very bizarre situation. In Solution Explorer, some of my forms did not display their forms icon, but rather a class icon. (This particular solution is under VSS control.)
Therefore, I cannot see the form in the forms designer. Most of the forms are inherited from FormBase, which only contains a status bar with panels.
Most of the forms are locked. I checked-out one form, and immediately its icon changed to the regular forms icon in Solution Explorer. I then undid the check-in, and the icon remained as the forms icon. I don't mind this 'work-around', but this technique worked on all the forms except for one.
Any ideas? TIA
Kevin Yu [MSFT] - 12 Aug 2005 02:51 GMT Hi larzeb,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that the inherited form icon in the solution explorer becomes a class icon instead of a form icon. If there is any misunderstanding, please feel free to let me know.
Could you let me know how you added the form? Did you add as an Inherited Form or something else? It will be helpful if you can paste the form class definition here. Also, does this happen on only one form in the project or all forms? Will it occur on other machines?
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 17 Aug 2005 23:05 GMT Kevin, Sorry it's taken so long to reply.
Your initial understanding is correct regarding the icon misrepresentation. Most of the forms are inherited from a base form, which includes a StatusBar with multiple panels.
The problem occurs on all forms.
Larry
>Hi larzeb, > [quoted text clipped - 12 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 18 Aug 2005 04:03 GMT Hi Larry,
I also tried to add the Status bar to a form and added several inherited forms, but all of the icons appear properly after the project is added to VSS. Could you please check if this also occurs on other machines? If this is a machine specific issue, I suggest you remove the local copy and get it from the VSS server again to see if this can resolve the problem.
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 18 Aug 2005 16:31 GMT Kevin,
Did you add a panel collection to the status bar in the base form?
Larry
>Hi Larry, > [quoted text clipped - 8 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 19 Aug 2005 08:37 GMT Hi Larry,
Yes I added two panels on it. If you get the whole solution from another machine, is that issue reproed?
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 19 Aug 2005 16:46 GMT Kevin,
I have only one development machine, so I can't try stuff on a second one.
I believe the problem lies in the interaction between Visual Studio and VSS. When I launch VS and some modules which I know to be forms have a VB icon and not a form icon, I check-out and undo-check-out, and the proper form icon appears.
As a test, I unbound VSS from this project. This did not change the improper icons during that session of VS. However, I closed down VS and then relaunched. All icons were correct.
Before I did this, I ran "Analyze and Fix VS DB", which showed no errors. I really hate to lose VSS functionality, but it's too hard to use VSS with this problem.
Any suggestions?
Thanks
>Hi Larry, > [quoted text clipped - 5 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 23 Aug 2005 08:39 GMT Hi Larry,
Since you have only one dev machine, I suggest you do the following to see if this can workaround the problem:
1. Check-in all modified code to the VSS server. 2. Close VS.NET and remove the local copy. 3. Open VS.NET and Select Open from Source Control from the File menu, to get all files again.
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 24 Aug 2005 16:33 GMT Kevin,
In step 2, removing the local copy, does this include the vssver.scc files?
Thanks
>Hi Larry, > [quoted text clipped - 10 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." larzeb - 24 Aug 2005 23:25 GMT Kevin,
I erased the whole source folder and reconstituted from Source Control. When I re-opened VS.NET, the source files which are forms still do not have the forms icons, only class icons.
>Hi Larry, > [quoted text clipped - 10 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 25 Aug 2005 11:48 GMT Hi Larry,
Could you post the whole .cs file here, so that I can check if this is the code issue or sourcesafe issue?
In a windows form class file, there must be only 1 class in it the .cs file. The class has to be inherited from System.Windows.Forms.Form.
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 25 Aug 2005 14:46 GMT Kevin,
It's VB. I'm sorry for the length of the code; this is the smallest one.
First, the base class:
Namespace MailHouse.BusinessLogic Public Class FormsBase Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form 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 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. Public WithEvents usb1 As System.Windows.Forms.StatusBarPanel Public WithEvents usb2 As System.Windows.Forms.StatusBarPanel Public WithEvents usbCompanyName As System.Windows.Forms.StatusBarPanel Public WithEvents usb As System.Windows.Forms.StatusBar <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.usb = New System.Windows.Forms.StatusBar Me.usb1 = New System.Windows.Forms.StatusBarPanel Me.usb2 = New System.Windows.Forms.StatusBarPanel Me.usbCompanyName = New System.Windows.Forms.StatusBarPanel CType(Me.usb1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.usb2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.usbCompanyName, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'usb ' Me.usb.Location = New System.Drawing.Point(0, 244) Me.usb.Name = "usb" Me.usb.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.usb1, Me.usb2, Me.usbCompanyName}) Me.usb.ShowPanels = True Me.usb.Size = New System.Drawing.Size(368, 22) Me.usb.TabIndex = 0 ' 'usb1 ' Me.usb1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring Me.usb1.Width = 171 ' 'usb2 ' Me.usb2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring Me.usb2.Width = 171 ' 'usbCompanyName ' Me.usbCompanyName.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents Me.usbCompanyName.Width = 10 ' 'FormsBase ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(368, 266) Me.Controls.Add(Me.usb) Me.Name = "FormsBase" Me.Text = "FormsBase" CType(Me.usb1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.usb2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.usbCompanyName, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False)
End Sub
#End Region
Private Sub InitializeStatusBar()
Me.usbCompanyName.Text = Tools.CompanyName & " (" & Tools.UserName & ")"
usb.BackColor = Color.Azure
End Sub
Private Sub FormsBase_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.InitializeStatusBar() End Sub End Class End Namespace
And the derived class:
Option Explicit On Option Strict On Imports MailHouse.DataAccess Imports MailHouse.Info Imports Infragistics.Win.UltraWinGrid
Public Class ScheduledZips Inherits FormsBase
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form 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 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. Friend WithEvents ugrdSchedZip As Infragistics.Win.UltraWinGrid.UltraGrid Friend WithEvents lblBatch As System.Windows.Forms.Label <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(ScheduledZips)) Me.ugrdSchedZip = New Infragistics.Win.UltraWinGrid.UltraGrid Me.lblBatch = New System.Windows.Forms.Label CType(Me.ugrdSchedZip, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'ugrdSchedZip ' Me.ugrdSchedZip.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ugrdSchedZip.Location = New System.Drawing.Point(16, 104) Me.ugrdSchedZip.Name = "ugrdSchedZip" Me.ugrdSchedZip.Size = New System.Drawing.Size(450, 224) Me.ugrdSchedZip.TabIndex = 0 ' 'lblBatch ' Me.lblBatch.Location = New System.Drawing.Point(16, 16) Me.lblBatch.Name = "lblBatch" Me.lblBatch.Size = New System.Drawing.Size(450, 80) Me.lblBatch.TabIndex = 1 ' 'ScheduledZips ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(488, 366) Me.Controls.Add(Me.lblBatch) Me.Controls.Add(Me.ugrdSchedZip) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximumSize = New System.Drawing.Size(496, 1000) Me.MinimumSize = New System.Drawing.Size(496, 400) Me.Name = "ScheduledZips" Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide Me.Text = "Mail Campaign Zips" Me.Controls.SetChildIndex(Me.ugrdSchedZip, 0) Me.Controls.SetChildIndex(Me.lblBatch, 0) Me.Controls.SetChildIndex(Me.usb, 0) CType(Me.ugrdSchedZip, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False)
End Sub
#End Region
'Display statistics for the selected Mail Campaign, including counts by Zip ' Original Mail Date and Scheduled Mail Date
#Region " Fields " Private m_MailCampaignDetailID As Integer Private m_NextMailDate As Date Private m_MailCampaignDescr As String Private m_Count As Integer #End Region
#Region " Constructors " Public Sub New(ByVal MailCampaignDetailID As Integer, _ ByVal NextMailDate As Date, _ ByVal MailCampaignDescr As String, _ ByVal Count As Integer)
Me.New() Me.MailCampaignDetailID = MailCampaignDetailID Me.NextMailDate = NextMailDate Me.MailCampaignDescr = MailCampaignDescr Me.Count = Count
End Sub #End Region
#Region " Private Methods " Private Sub ScheduledZips_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.displayGrid() Me.displayLabel()
End Sub Private Sub displayGrid()
Dim sm As ScheduledMailingsDB = New ScheduledMailingsDB Dim ds As DataSet = sm.ScheduleZips(m_MailCampaignDetailID, m_NextMailDate) ugrdSchedZip.DataSource = ds ugrdSchedZip.DataMember = "ScheduleZips"
End Sub Private Sub displayLabel()
Dim sm As ScheduledMailingsDB = New ScheduledMailingsDB Dim mailing As New MailingsDB Dim BatchID As Integer = mailing.BatchIDFromMailCampaign( _ m_MailCampaignDetailID, m_NextMailDate)
Dim mb As New MailingBatchDB Dim mbi As MailingBatchInfo = mb.GetMailingBatch(BatchID)
Dim bt As String = mbi.BatchType.ToString Dim pt As String = mbi.PostageType.ToString
Dim dt As String = "Original Mail Date - " & _ mbi.DateAdded.ToString("F")
Dim mcd As New MailCampaignDetailDB Dim mcdi As MailCampaignDetailInfo ' Retrieve a MailCampaignDetailInfo record for this next MailCampaignDetailID mcdi = mcd.GetMailCampaignDetail(m_MailCampaignDetailID) ' and use its NextMailDate and Sequence in the array we are building
Dim NextMailDate As String = "Scheduled Mail Date - "
If mcdi.DaysUntilNext = 0 Then NextMailDate &= "End of sequence" Else NextMailDate &= sm.CalculateNextMailDate(mbi.DateAdded, mcdi.DaysUntilNext).ToString("D") End If
lblBatch.Text = "Scheduled Mail Campaign - " & m_MailCampaignDescr & ControlChars.NewLine & _ "Original Mail Campaign - Batch ID - " & BatchID.ToString & _ ", " & bt & ", " & pt & ControlChars.NewLine & "Total Count - " & m_Count & ", Sequence - " & _ mcdi.Sequence & ControlChars.NewLine & _ dt & ", " & ControlChars.NewLine & NextMailDate
End Sub Private Sub ugrdSchedZip_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ugrdSchedZip.InitializeLayout e.Layout.Bands(0).Columns("Total Count").Hidden = True e.Layout.Bands(0).Columns("Descr").Width = 250 e.Layout.Bands(0).Columns("Descr").Header.Caption = "Description" e.Layout.Bands(0).Columns("Zip").Header.Caption = "Zip Code" e.Layout.Bands(0).Columns("Count").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
e.Layout.Override.AllowAddNew = AllowAddNew.No e.Layout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False e.Layout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False 'Display total count for this Mail Campaign 'e.Layout.Bands(0).Summaries.Add(SummaryType.Sum, e.Layout.Bands(0).Columns(3))
End Sub #End Region
#Region " Properties " Public Property MailCampaignDetailID() As Integer Get Return m_MailCampaignDetailID End Get Set(ByVal Value As Integer) m_MailCampaignDetailID = Value End Set End Property Public Property NextMailDate() As Date Get Return m_NextMailDate End Get Set(ByVal Value As Date) m_NextMailDate = Value End Set End Property Public Property MailCampaignDescr() As String Get Return m_MailCampaignDescr End Get Set(ByVal Value As String) m_MailCampaignDescr = Value End Set End Property Public Property Count() As Integer Get Return m_Count End Get Set(ByVal Value As Integer) m_Count = Value End Set End Property #End Region
End Class
>Hi Larry, > [quoted text clipped - 8 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 26 Aug 2005 11:23 GMT Hi Larry,
This works fine on my machine. I assume there might be something wrong with the integration of VS.NET and VSS. Since the icon will not affect much for the development, I suggest you leave as it is, or we have to reinstall VS.NET and VSS.
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 26 Aug 2005 15:25 GMT Kevin,
I does affect development! I cannot edit forms - there is no designer available.
Larry
>Hi Larry, > [quoted text clipped - 7 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 30 Aug 2005 10:35 GMT Sorry, Larry. I didn't know that you cannot use the form designer now. Since I could not repro it on my computer by creating a new project, could you please send me your project by email? Remove 'online' from the no spam alias is my real email address.
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Kevin Yu [MSFT] - 08 Sep 2005 06:34 GMT Hi Larry,
Thanks for sending me the project. When I opened the project, the icon for the .cs file was a class file icon, because the project cannot build due to lack of come reference dlls. But when I made some modification to it and made it built, the icon changed to windows form icon. Which works fine. Can you check if it can be built on your machine?
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 08 Sep 2005 14:46 GMT Kevin,
Thanks for looking at the project for me.
First, I also opened the solution. After indicating that it couldn't resolve where the VSS was, and also indicating that some projects could not be located, I opened Solution Explorer and looked at Mailhouse project. In a folder called Forms, there are 21 vb modules, all of which are locked. Three of the 21 have form icons, while the remainder have VB class icons. The 18 VB class icons should be Forms icons, and therefore I cannot open the designer on them.
I am confused about your mention of a .cs file. All the files should be VB. Also, what modification did you make which turned the module from a CS to Form module?
Thanks
>Hi Larry, > [quoted text clipped - 8 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 09 Sep 2005 09:34 GMT Hi Larry,
Sorry, my mistake. It has to be .vb file. (So used to csharp projects.) You cannot get the icon change to winform icon, because the project cannot be built. Once you add the dependency dlls to the project and make it built successfully, the icons will be changed to correct ones.
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
larzeb - 13 Sep 2005 19:31 GMT Kevin,
The sample I sent you was not complete. I only sent you a single project in a solution which contains 10 projects. I just wanted you to see the problem.
Of course, I do have the entire solution, and it is complete, with no unresolved dependencies. That is not the issue,
The computer which runs Visual Studio belongs to a Windows 2003 domain. The source code is stored on a network share. It runs correctly, except for the icon issue.
I just got a new computer, loaded Windows XP SP2 and fully updated it security wise. I then installed Visual Studio, Visual SourceSafe and SQL Server. I then loaded all the third-party software used in the solution (Active Reports, Infragistics, etc.) and did a build. There were no errors!
However, the icon issue still exists on this new machine. What now?
Larry
>Hi Larry, > [quoted text clipped - 7 lines] >"This posting is provided "AS IS" with no warranties, and confers no >rights." Kevin Yu [MSFT] - 15 Sep 2005 08:45 GMT Sorry, Larry, I tried but cannot repro this on my machine. When I make this project build successfully, the icon of this file changed to windows form icon automatically. And I can open it with the windows form designer.
In this case, I suggest you contact Microsoft PSS for this issue directly. Their information can be get from the following link:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|