473,654 Members | 3,097 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CheckListBox.ch ecked

MSN
xp pro/vs 2002/web forms/VB

How do I make a checkbox checked when add it to a checkboxlist.

Thanks
Nov 20 '05 #1
16 4638
* "MSN" <To************ @msn.com> scripsit:
How do I make a checkbox checked when add it to a checkboxlist.


\\\
Me.CheckedListB ox.Items.Add("F oo", True)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Errata:

Sorry, I missed the "web forms" for some reason...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Hi MSN,

You can use the designer and than the collections and set selected to true,

Or you can do it in code than it is
\\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Me.CheckBoxList 1.Items(0).Sele cted = True
End Sub
///
OR
In the aspx html page
\\\
<asp:CheckBoxLi st id="CheckBoxLis t1" style="Z-INDEX: 102; LEFT: 416px;
POSITION: absolute; TOP: 304px"
runat="server" Width="163px">
<asp:ListItem Value="Eerste" Selected="True" >Eerste</asp:ListItem>
</asp:CheckBoxLis t>
///

I hope this helps?

Cor
Nov 20 '05 #4
> Sorry, I missed the "web forms" for some reason...

I missed it as well, I am suprissed you saw it.
(I made the in my idea correct answer)

:-)

Cor
Nov 20 '05 #5
MSN,
Have you tried something like:

Dim item As New ListItem("apple s")
item.Selected = True
CheckBoxList1.I tems.Add(item)

Hope this helps
Jay

"MSN" <To************ @msn.com> wrote in message
news:uk******** ******@TK2MSFTN GP09.phx.gbl...
xp pro/vs 2002/web forms/VB

How do I make a checkbox checked when add it to a checkboxlist.

Thanks

Nov 20 '05 #6
Hi Jay,

Look at the post from Herfried, therefore I made some extra work to correct
it.
(If Herfried is right, and in this case I assume that)

Cor
Nov 20 '05 #7
* "Cor Ligthert" <no**********@p lanet.nl> scripsit:
Look at the post from Herfried, therefore I made some extra work to correct
it.


I still don't understand why Jay's solution should be wrong...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
Hi,
Look at the post from Herfried, therefore I made some extra work to correct it.


I still don't understand why Jay's solution should be wrong...


Did I say that Herfried?

However that kind of answers you see not do me.

You are right.

Stuppid me.

Cor
Nov 20 '05 #9
* "Cor Ligthert" <no**********@p lanet.nl> scripsit:
Look at the post from Herfried, therefore I made some extra work to correct it.


I still don't understand why Jay's solution should be wrong...


Did I say that Herfried?


Sounded like that, but EOT ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #10

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

Similar topics

3
8698
by: john sutor | last post by:
Does anyone know how to get the index of an item checked and then check it if it is unchecked?
3
9297
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data, checkbox's and icons are displayed as they are meant to be. My problem is this, I am trying to achieve the same results as I get with CheckListBox(s), where I am able to select (Check-mark) various checkboxs items and able to alter the data. I do...
1
4233
by: satankidneypie | last post by:
Hi, has anyone implemented a checkedlistbox with images as well as text, and if so can I have some sample code please?! Thanks, Stu
0
280
by: D. Shane Fowlkes | last post by:
I have a form with a CheckBoxList which is created from a SQLDataReader. It contains Staff personnel and I use the ID and LogOnName (a string) to build the CBL. All works fine. I also have a "Remember my settings" checkbox on the form that if checked, will run a sub routine to create a cookie to store the IDs of the checked names in the CBL. The idea is to have the form "remember" the user's selections so when they come back to the form...
2
16648
by: Mike Kim | last post by:
hi all, i have a checklistbox populated with about 50 items from database. and on the same form, i added to button to do the following. if you click this button, i want to have all items in the checklistbox to be checked i want to have all items in the checklistbox to be unchecked. thanks advance, folks.
2
5960
by: cos75 | last post by:
When I populate a checklistbox with Add method every item is showed equal to the others I would show some item enabled, and some disabled......some item in black text and others in red text Is possible Thank yo cos7
0
3111
by: Ville Mattila | last post by:
Dear readers, I've some problems with the data binding of the checklistbox control. I'm using it with user preferences that are stored in a XML File. Information from the file is fetched with SelectSingleNode and XPath. The checklistbox list values and display texts are loaded from a datatable. I've managed to do that with the DataSource, DisplayMember and ValueMember. No problems with that.
1
1929
by: obrienkev | last post by:
Hi, I want to mark the CheckListBox items as Checked based on a database query. So the CheckListBox items should be checked if each item matches fundsAffected field from the below query... SELECT DISTINCT fundsAffected as myFunds FROM myFunds AS f INNER JOIN myDetails AS d ON d.corpID = f.corpID WHERE d.securityID = securityID
3
3382
by: khalidjan9 | last post by:
I have data in an arraylist and i want to add data to checklist box on runtime and i also want to display a textbox besides it so that i get the comments example : checklistbox "text" textbox checklistbox "text" textbox checklistbox "text" textbox checklistbox "text" textbox checklistbox "text" textbox can any 1 pleeez help... tks in adv.. :)
0
8375
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8593
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4149
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2714
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 we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.