checking if listitem is checked

I'm trying to validate that a certain number of listitems are checked in a checkboxlist control. How do I modify this VB.net to do that check? This always has more than 4 because it just counts the number of listitems. Thanks for any advice.

Dim i As Integer

i = 0

For Each ListItem In CheckBoxList1.Items

i = i + 1

Next

If Not i > 4 Then

errorlbl.Text = "You must select at least five items"

Else

ResponseAndRedirect()

End If
 
0
marchnw
11/13/2008 3:32:19 PM
asp.net.visual-basic.net 3721 articles. 0 followers. Follow

3 Replies
628 Views

Similar Articles

[PageSpeed] 31

You are almost there, check this code.. 

Dim i As Integer

i = 0
 
For Each li As ListItem In CheckBoxList1.Items
    If li.Selected Then    
          i = i + 1
    End If 
Next

If Not i > 4 Then

errorlbl.Text = "You must select at least five items"

Else

ResponseAndRedirect()

End If

  

My Blog


"Don't be afraid to be wrong; otherwise you'll never be right."
0
budugu
11/13/2008 3:44:45 PM

 Hi,

 add : 

 If ListItem.Selected Then
                i = i + 1
 End If


Regards,

Shandy Hidayat, MCPD
0
shandyhidayat
11/13/2008 3:46:35 PM

Thanks for the quick responses. I knew if couldn't be as difficult as I was trying to make it.

0
marchnw
11/13/2008 3:56:37 PM
Reply:

Similar Artilces:

Visual Studio .Net? Visual Basic .Net?
Okay, I admit it -- I know nothing about .Net. I'm a Visual Basic and ASP developer. DotNetNuke is my first tentative step into the whole ".Net Thing", and I'm looking for some advice... What do I really need to be able to make some modifications, or new modules for DotNetNuke? Do I need the full, THOUSAND DOLLAR Visual Studio .Net 2003 package, or can I get away with the HUNDRED DOLLAR Visual Basic .Net Standard package?Chameleon Systems, Inc. You can use webmatrix, available here for free. One of the drawbacks of webmatrix however is that it does not support code-be...

Visual Basic.NET or Visual Studio.NET?
OK, this has probably been asked before... I'm a student looking to cut my costs, and I can do this by just purchasing Visual Basic.NET as opposed to the fully-fledged Visual Studio.NET application. Of course, I'll only be able to program in VB, but that's fine with me. I wanted to know if all of the ASP.NET specific options are available, such as using a WYSIWYG editor? I'd also like to know if VB.NET has IntelliSense, or that's a specific option only available to Visual Studio.NET users. Thanks in advance. I'd have to believe that VB.Net has intellisense. What is the price d...

Visual Basic.NET or Visual Studio.NET? #2
I am currently using the Web Matrix to develop ASP.NET applications, but I am keep to upgrade to VS.NET. However, I can't justify spending $1,000 at the moment. I then found the MUCH cheaper "Visual Basic .NET 2003 Standard Edition" which is only $100. I have very little C# knowledge, and use Basic almost all the time. Would this be a good tool to use for web development? Does it support all the code behind stuff that VS users love so much? Thanks!! I use "VB.NET Standard Edition" and I'm happy with it. It has exactly the same features as Visual Studio.NET. Th...

Visual Basic .NET 2003 vs Visual Studio .NET 2003
Hi, If im going to be coding my ASP.NET in just VB.NET then would I be able to go for the cheaper option of buying Visual Basic .NET 2003 ?? - Carl S Yes.Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog Are there any limitations if I was doing my ASP.NET with VB.NET in Visual Basic .NET 2003 than if I was using the full Visual Studio .NET 2003 ?? Or are the only advantages of Visual Studio .NET 2003 in that it supports more programming languages ?? - Carl S You should check the MS Web site, but I believe that, given an edition (Standard, Professional...

VS.Net Check In/Check Out Function
Hi All, I work on a team of developers who are just trying to get started with ASP.Net.  I've been doing development for 2+ years so it's not new to me but my colleagues have asked a question about the VS.Net environment that I can't answer.  We're trying to find out if there is some sort of Check In/Check Out function with Visual Studio.Net.  I've never worked in a team environment before so I couldn't answer this.  The reason we're wondering is because we're planning on setting up our online forms in a DotNetNuke style environment (one page, loads user contro...

ADO.NET Programming in Visual Basic .NET
Has anyone read "ADO.NET Programming in Visual Basic .NET, Second Edition" by Steve Holzner (Author), Bob Howell (Author)? I am trying to working on a project and there are a few things that I need to tie up quickly in my web forms. Is this book a good one? karls------------------------------------'Old and wrinkled is not what I expected to become when I grew up!'...

Converting Visual Basic 6 to Visual Basic .NET
Hi, I found this program that would get the mac address of a computer given its IP. I converted it into vb.net and it gave 2 errors. It said that I couldn't use "any" in declarations, so I found out what variable it was tryign to pass and changed the any to that data type. Now, the program will start in vb.net... but when I click the button, it returns the wrong mac address, while the one in vb6 returned the correct one.All you have to do is add 2 textboxes to the form and 1 button, dont change their names.::::::::::VB6 CODE::::::::::Option ExplicitPrivate Const NO_ERROR = 0Private Declare F...

C# Visual Basic.NET JScript.NET what should I choose ?
I'm just a beginner with programing ASP.NET web sistes. Unfortunatelly I don't know any of the languages supported by ASP. (By the time I programmed in DELPHI and SQL) So I should start to learn one of the languages. Could somebody help me to choose the language I should use ? Which and why ? Thanks in advance, Gonzi Use C# or VB.NET, which ever you are comfortable with. Go here to see sample of both in use http://samples.gotdotnet.com/quickstart/aspplus Ultimately, once you get more advanced, you'll really want to become comfortable with both languages. I ...

Check In/Check out
I am using PowerBuilder 9. The undo check out is right next to the check in. This is a big problem! I so easy to select Undo check out and lose all of your changes. I lost 8 hours of work yesterday because of it. I know I should be more careful. However, there should be a "Are you sure" some where also. PLEASE FIX!!!!!!!!!!!!! -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ This isn't the tech support line, it's an end-user forum. If you want to report a bug, use CaseXpress and either open a case or report a bug ...

net checking
Sir I have an intranet application using ASP.Net in that application there are some pages required internet connection.If internet connection was not available then i want to redirect some other page how can i do this ??. I'm using vb as code behind thanks in advance PrasantH I think therefore i'mvPras©...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Better to ask this in the source control group. Lots of posts on PBNative -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69678e.7b3a.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Native. ...

Check in
Hi all. I am migrating from PB 7.0 to PB 10.5, After migrating my first application i am trying to work on my first window but i'am not able to find out the way to CHECK it OUT. Wher do i can find "check out/check in" functions ?? TIA Mario Parietti What source control are you using? Have you configured it? Right click on your Workspace and check the source control tab to see if you've got it set up. "Mario Parietti" <mparietti@intercad.ch> wrote in message news:451283e0$1@forums-1-dub... > Hi all. > I am migrating from PB...

Check In Check Out
I have some source code that I need to modify and it was sent to me in a Registered status. Therfore, when I open any object it says " 'object name' is registered but not checked out and therefore can not be overwritten. Open anyway?" Then when I try to check it out, I get "PBNative checkout not allowed for registered objects." How can I get around this? When I look under the "Source" menu, all the items concerning registered are grayed out. TIA Option1:Copy the object(Only) to someother pbl and try . Option2:If You have any SCC Expo...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Have you looked the PB8 User's guide? Chapter 3 talks about source control. -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69ba0a.592b.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Na...

Web resources about - checking if listitem is checked - asp.net.visual-basic.net

Design rule checking - Wikipedia, the free encyclopedia
Design Rule Checking or Check(s) ( DRC ) is the area of Electronic Design Automation that determines whether the physical layout of a particular ...

Facebook Restores Access To Tumblr Page Obama Is Checking Your Email, Blames Automated Response
... , of any knowledge of or participation in Prism. A few eyebrows were likely raised over the weekend, when access to Tumblr page Obama Is Checking ...

The Getting Started Series: Checking Performance of your Facebook Ads
Use Ads Manager to check performance of your Facebook Ads.

State of Journalism: The Lost Art of Fact Checking
... Read all the posts here.It wasn’t exactly Bright Lights, Big City. Jay McInerney’s well State of Journalism: The Lost Art of Fact Checking March ...

Random people from the FiDi and Flickr HQ team checking out Venus transit of the Sun (2012) - Flickr ...
John Ubante had his Canon rig set up for the Venus transit Flickr HQ staff and lots of passers by stopped to check out the show.

Checking Your Privilege: A How-To for Hard Things - YouTube
Leslie Hawthorn http://lca2015.linux.org.au/schedule/30258/view_talk Over the past 3 years, we’ve witnessed the discussion of the role of women ...

Q&A: Checking rego date
Hugo is wondering what is the best way to check vehicle registration date now that cars no longer have rego labels in NSW.

Australian Paralympic Committee checking review on Canberra swimmer Hayley Morris
Australian Paralympic Committee chief executive Jason Hellwig wants to be assured the correct protocols were followed for Canberra teenager Hayley ...

Australian police checking MH17 site
Independent monitors are helping Canberra negotiate with armed rebels over access to the MH17 crash site.

Q&A: Checking rego date
Hugo is wondering what is the best way to check vehicle registration date now that cars no longer have rego labels in NSW.

Resources last updated: 1/1/2016 7:29:39 PM