Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2007, 04:00 AM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to doctorwcc
Default Design Time Exception in WinForm

Please read carefully about the problem i m facing. And help me please.
I have a form class called frmMgt.
frmMgt has a protected member i.e :
Protected WithEvents DGV as DatagridView

A form class frmProjectsMgt inherits frmMgt.
Another form class frmUnitsMgt also inherits frmMgt.

When I try to write the following event handler in any of the derived class, a warning is shown immediately, and when I try to switch from code view to design view of the derived class, the designer is not visible but a strange design time exception is shown
The event is:

'(in frmProjectManagement Form)

  Private Sub dgv_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEve ntArgs) Handles dgv.CellFormatting
        Dim row As DataGridViewRow
        For Each row In Me.dgv.Rows
            If row.Cells("Status").Value = "Sold" Then
                row.DefaultCellStyle.BackColor = Color.Blue
            End If
        Next
    End Sub

'Code Ended here
----------------

The warning says:
The event cellformatting is read-only and cannot be changed

When I switch to the design view I see the following alongwith a cross (critical error) icon:

One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.

The event CellFormatting is read-only and cannot be changed.
Hide

at System.ComponentModel.Design.EventBindingService.E ventPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDom SerializerBase.DeserializeAttachEventStatement(IDe signerSerializationManager manager, CodeAttachEventStatement statement)
at System.ComponentModel.Design.Serialization.CodeDom SerializerBase.DeserializeStatement(IDesignerSeria lizationManager manager, CodeStatement statement)

This also occur when I try to write DGV.CellContentClick event in the derived classes. But surprisingly, DGV.CellClick event in the derived class is causing no problems at all!
Further. The application causes no problems at run-time. All the problem is seen in the form designer. And the Error (warning) list does not show file name. And also tell that Line number: 0 and Column No: 0 in the errors list.
Why is this?
Why can't I write some of event handlers of a protected member of a base class in a derived class?

Regards







Hamid





Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing in Design Time Farside Visual Studio 2005 1 August 9th, 2007 06:42 PM
xxx_Init( ... ) design-time method? bradnerdhss BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 August 8th, 2006 06:52 PM
Design-Time or Run-Time now ? ALGNET .NET Framework 2.0 1 July 31st, 2006 04:43 AM
Exception design on Boxoffice Sample Application? dleal BOOK: Professional Java Development with the Spring Framework 1 November 11th, 2005 06:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.