473,566 Members | 2,847 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.W ebControls
Imports System.Componen tModel

Namespace customValidator s
Public Class RequiredFieldVa lidatorForCheck BoxLists
Inherits System.Web.UI.W ebControls.Base Validator

Private _listctrl As ListControl

Public Sub RequiredFieldVa lidatorForCheck BoxLists()
EnableClientScr ipt = False
End Sub

Protected Overrides Function ControlProperti esValid() As Boolean
Dim ctrl As Control
ctrl = FindControl(Con trolToValidate)
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.Selec tedIndex <> -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 1041
Try:

Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.W ebControls


--
TDAVISJR
aka - Tampa.NET Koder
"Manny Chohan" <Ma*********@di scussions.micro soft.com> wrote in message
news:40******** *************** ***********@mic rosoft.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.W ebControls
Imports System.Componen tModel

Namespace customValidator s
Public Class RequiredFieldVa lidatorForCheck BoxLists
Inherits System.Web.UI.W ebControls.Base Validator

Private _listctrl As ListControl

Public Sub RequiredFieldVa lidatorForCheck BoxLists()
EnableClientScr ipt = False
End Sub

Protected Overrides Function ControlProperti esValid() As Boolean
Dim ctrl As Control
ctrl = FindControl(Con trolToValidate)
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.Selec tedIndex <> -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.W ebControls


--
TDAVISJR
aka - Tampa.NET Koder
"Manny Chohan" <Ma*********@di scussions.micro soft.com> wrote in message
news:40******** *************** ***********@mic rosoft.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.W ebControls
Imports System.Componen tModel

Namespace customValidator s
Public Class RequiredFieldVa lidatorForCheck BoxLists
Inherits System.Web.UI.W ebControls.Base Validator

Private _listctrl As ListControl

Public Sub RequiredFieldVa lidatorForCheck BoxLists()
EnableClientScr ipt = False
End Sub

Protected Overrides Function ControlProperti esValid() As Boolean
Dim ctrl As Control
ctrl = FindControl(Con trolToValidate)
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.Selec tedIndex <> -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?TWFubnkgQ2h vaGFu?= <Ma*********@di scussions.micro soft.com> wrote
in news:40******** *************** ***********@mic rosoft.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********@rog ers.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
1998
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 investment advice. So in the page question1.php = a form "action = question2.php" and in question2.php the variables (results of the form) are...
16
2719
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 individiduals for a given month and year OR an individual for the whole year for example. My question, is there any way to have blank (not filled...
8
3675
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 and passes it two parameters. For the life of me I cannot figure out what the error is, but one occurs everytime I click a &%*$&# radio button. ...
2
1141
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
1902
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 version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>...
3
1681
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 answer is correct or incorrect. Below is the code that the book has me using. Can someone please tell me where I have gone wrong and how I can fix it. ...
4
1369
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
4075
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 hotspots on the image. One being correct(a) and the other incorrect(b). When the user clicks on the correct hotspot or place on the image, it should score...
6
3126
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, B, C, D... This is part of my code for the multiple question to see if its the aswer is correct or not. Here I made the A, B, C, D in...
0
7666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8108
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.