Question2

G

Guest

I converted the C# code from 4guysfromrolla into vb.net. When i try to
compile it, i get the following error:

A namespace does not directly contain members such as fields or methods

Here is the code i have:

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel

Namespace customValidators
Public Class RequiredFieldValidatorForCheckBoxLists
Inherits System.Web.UI.WebControls.BaseValidator

Private _listctrl As ListControl

Public Sub RequiredFieldValidatorForCheckBoxLists()
EnableClientScript = False
End Sub

Protected Overrides Function ControlPropertiesValid() As Boolean
Dim ctrl As Control
ctrl = FindControl(ControlToValidate)
If Not (ctrl Is Nothing) Then
_listctrl = CType(ctrl, ListControl)
Return Not (_listctrl Is Nothing)
Else
Return False
End If

End Function

Protected Overrides Function EvaluateIsValid() As Boolean
Return _listctrl.SelectedIndex <> -1
End Function
End Class
End Namespace


Can someone please tell me what is the problem with it?

Thanks

Manny
 
L

Lucas Tam

Can someone please tell me what is the problem with it?

Is this a custom project? Or a Class object?

If it is... you might have to add a reference to the proper DLL.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top