Overridable problem

D

dbuchanan

Why can't I add the 'Overridable' key word to any of the methods
or events in my base class? VB.NET thinks I am trying to define a
variable. What am I doing wrong?

I get the squiggly line under most of the method and the error reads
"Option Strict On requires all vaiable declarations to have an
'AS' clause"

Example code 1:

Protected Overrideable Sub SaveRecord()
' stuff to save a record
End Sub

Example code 2:

Protected Overrideable Sub DataGrid1_MouseUp(ByVal sender As
Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles
DataGrid1.MouseUp
'Highlight the entire row
'Get the X and Y of the DataGrid from the mouse event
Dim pt As New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = Me.DataGrid1.HitTest(pt)

If hti.Type = DataGrid.HitTestType.Cell Then
'Me.DataGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column)
Me.DataGrid1.Select(hti.Row)
End If
End Sub

Please help.

-Doug
 
G

Guest

Doug,

In order to use the Overridable keyword you need to spell it correctly in
your code.

Kerry Moorman
 
H

Herfried K. Wagner [MVP]

dbuchanan said:
Why can't I add the 'Overridable' key word to any of the methods
or events in my base class? VB.NET thinks I am trying to define a
variable. What am I doing wrong?

I get the squiggly line under most of the method and the error reads
"Option Strict On requires all vaiable declarations to have an
'AS' clause"

Example code 1:

Protected Overrideable Sub SaveRecord()

The keyword's name is 'Overridable', not 'Overrideable'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top