Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια
σε

 

Αρχική σελίδα Ιστολόγια Συζητήσεις Εκθέσεις Φωτογραφιών Αρχειοθήκες

Πρόβλημα με την εμφάνισης κληρονομικής φόρμας

Îåêßíçóå áðü ôï ìÝëïò Ηλίας Κεκάκος. Τελευταία δημοσίευση από το μέλος nikolaosk στις 13-06-2009, 13:39. Υπάρχουν 3 απαντήσεις.
Ταξινόμηση Δημοσιεύσεων: Προηγούμενο Επόμενο
  •  12-06-2009, 21:57 51611

    Πρόβλημα με την εμφάνισης κληρονομικής φόρμας

    Γεία σας,
    Έχω φτιάξει μια base φόρμα με διάφορα controls. Ένα από αυτά είναι και ένα κουμπι που το μόνο που κάνει είναι να κλείνει την φόρμα (Me.Close).
    Το μήνυμα είναι το εξής:

    .MainHeaderText { font:.8em tahoma; color:#FFFFFF; font-weight:bold; }.MainHeaderErrorNumberText { font:.7em tahoma; color:#000000; }.MainHeaderWhyText { font:.8em tahoma; color:#FFFFFF; text-decoration:underline; cursor:hand; }.MainHeaderIgnoreText { font:.8em tahoma; color:#FFFFFF; text-decoration:underline; cursor:hand; }.MainHeaderBackground { background-image:url('C:\Documents and Settings\kekakoe\Local Settings\Temp\tmp103.tmp.gif'); background-repeat:repeat-x; background-color:#434E5E; }.ErrorHeaderErrorText { font:.7em tahoma; color:#000000; font-weight:bold; }.ErrorHeaderGoToCodeText { font:.7em tahoma; color:#000080; text-decoration:underline; cursor:hand; }.ErrorBodyTitle { font:.8em tahoma; font-weight:bold; color:#000080; }.ErrorBodyLink { font:.8em tahoma; color:#0099FF; text-decoration:underline; cursor:hand; }.ErrorBodyLinkNoSizing { color:#0099FF; text-decoration:underline; cursor:hand; }.ErrorBodyText { font:.8em tahoma; color:#000000; }.ErrorBodyCallStack { font:.7em tahoma; color:#000000; }.ClickableCell { cursor:hand; }
    To prevent possible data loss before loading the designer, the following errors must be resolved:
    1 Error
    Ignore and Continue
    Why am I seeing this page?
    The event ButtonClick is read-only and cannot be changed.
     
    Instances of this error (1)
    1.
    at System.ComponentModel.Design.EventBindingService.EventPropertyDescriptor.SetValue(Object component, Object value)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAttachEventStatement(IDesignerSerializationManager manager, CodeAttachEventStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
     
    Φυσικά μπορούμε να πατήσουμε IGNORE and CONTINUE και να συνεχίσουμε.
    Μήπως όμως γνωρίζει κανείς πως μπορούμε να το εξαφανίσουμε;

    Ευχαριστώ
    Ηλίας
  •  12-06-2009, 23:24 51617 σε απάντηση της 51611

    Απ: Πρόβλημα με την εμφάνισης κληρονομικής φόρμας


    δες προσεκτικά αυτό εδώ

    και δώσε βάρος σε αυτό το σημείο.στο παρακάτω snippet είναι και code και explanation.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
     
    If the base clase already handles the btnOK.Click event, eg:
    
    Partial Public Class BaseForm
    Protected Overridable Sub btnOK_Click(
    ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles btnOK.Click
    ----------------------
    ' .... code ...
    End Sub
    End Class
    
    Then the derived class
    does not need to handle the event ("Handles"), only
    override it, eg:
    
    Partial Public Class DerivedForm
    Protected Overridable Sub btnOK_Click(
    ByVal sender As System.Object,
    ByVal e As System.EventArgs)
    
    ' ... code that runs before base.btnOK_Click here ...
    
    MyBase.btn_OK_Click(sender, e)
    
    ' ... code that runs after base.btnOK_Click here ...
    End Sub
    End Sub
    
    In this example the base class handles the event while the derived class
    only overrides it (doesn't handle it again).
    
    If you do handle the event in both the base form and derived form and
    override it then this would not cause an Exception but would cause the
    eventhandler to fire twice.
    
    The Exception is most likely caused because the btnOK (in the base class)
    has no 'protected' Modifier(see btnOK properties) and therefore you can't
    add events in the derived class (in VB.Net terms doesn't allow you to use
    "Handles"). BUT as explained earlier you probely don't need this event
    handling in the derived class because you are already overriden it.


    Νικόλαος Καντζέλης
    BSc, MSc, MCAS, MCPD, MCITP, MCTS,MCP, MCT
    http://www.nksolutions.gr
    http://dotnetstories.wordpress.com
    http://weblogs.asp.net/dotnetstories
    http://forum.dotnetnuke.gr
  •  13-06-2009, 13:24 51627 σε απάντηση της 51611

    Απ: Πρόβλημα με την εμφάνισης κληρονομικής φόρμας

    Τελικά η απάντηση είναι ως εξής: Για να εξαφανισθεί αυτό το μήνυμα ο modifier όλων των controls της parent form θα πρέπει να είναι PROTECTED.
  •  13-06-2009, 13:39 51629 σε απάντηση της 51627

    Απ: Πρόβλημα με την εμφάνισης κληρονομικής φόρμας


    ωραία....
    σήμανε την ερώτηση σαν απαντημένη..

    Νικόλαος Καντζέλης
    BSc, MSc, MCAS, MCPD, MCITP, MCTS,MCP, MCT
    http://www.nksolutions.gr
    http://dotnetstories.wordpress.com
    http://weblogs.asp.net/dotnetstories
    http://forum.dotnetnuke.gr
Προβολή Τροφοδοσίας RSS με μορφή XML
Με χρήση του Community Server (Commercial Edition), από την Telligent Systems