473,499 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question2

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

Nov 19 '05 #1
3 1034
Try:

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


--
TDAVISJR
aka - Tampa.NET Koder
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
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

Nov 19 '05 #2
I still get the same error:

"TDAVISJR" wrote:
Try:

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


--
TDAVISJR
aka - Tampa.NET Koder
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
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


Nov 19 '05 #3
=?Utf-8?B?TWFubnkgQ2hvaGFu?= <Ma*********@discussions.microsoft.com> wrote
in news:40**********************************@microsof t.com:
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.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1993
by: Martien van Wanrooij | last post by:
Some time ago I already posted a question about a site that consists of several pages where the visitor, on every page can answer one or two questions in order to fill out an intake for for an...
16
2707
by: cover | last post by:
I have a form with drop down menus to query for name, month, and year to capture activity accordingly by an individual for a given month and given year. But I'd like to also be able to query ALL...
8
3664
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function...
2
1140
by: Preston | last post by:
int a = 1; how to print out a like 00000001 if a++, print out like 00000002...0000xxxx thank u
7
1898
by: 511475 | last post by:
What is the best checker to use to find these probles with, besides an experienced set of eyes? This probram is to grade the response to input by user. Grades his marks. Thanks <?xml...
3
1673
by: manleytim | last post by:
Hello, I am pretty new to JavaScript. I was trying one of the examples in my Text Book JavaScript Third Edition and for some reason I can't seem to get the windows alert popups to say if the...
4
1364
by: Lord0 | last post by:
Is it possible to validate/check for the following using a schema? <question answer="yes"> <answer>This is the answer</answer> </question> OR <question answer="no" />
1
4063
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
6
3120
nomad
by: nomad | last post by:
I have a general question on how to select multiple question on a quiz. The quiz is done in html and php, with a post method. The post info connect to a php file. By the way the the guess are A,...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.