473,770 Members | 6,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

programatically created checkboxes within panels again....

ok guys you have been a great help so far with this but im still struggling

I have some programatically created checkboxes within a panel

how can i set a checkbox to be actually checked (i.e. change its state)

currently im doing the following:
While count < DS4.Tables(0).R ows.Count
While count2 < Me.Panel2.Contr ols.Count
If DS4.Tables(0).R ows(count)(0) =
Me.Panel2.Contr ols.Item(count2 ).Text.ToString Then

'NEED SOME CODE TO SET THE CHECKBOX WITHIN THE PANEL TO CHECKED

End If
count2 = count2 + 1
End While
count2 = 0
count = count + 1
End While

Basically im looping through a dataset to see if the value in the dataset is
the same as the text on a checkbox, if it is i need to set the checkbox to
checked, but i have no idea how to do it

Thanks

Mike Fellows
Jul 14 '06 #1
3 1093
I managed to do this, very simply in all honesty

by doing the following

Dim cbx As CheckBox
cbx = Me.Panel2.Contr ols.Item(count2 )
cbx.Checked = True
Me.Panel2.Contr ols.RemoveAt(co unt2)
Me.Panel2.Contr ols.Add(cbx)

Thanks though

"Mike Fellows" <mi************ *@equityhouse.N OSPAM.co.ukwrot e in message
news:yL******** *************** *******@giganew s.com...
ok guys you have been a great help so far with this but im still
struggling

I have some programatically created checkboxes within a panel

how can i set a checkbox to be actually checked (i.e. change its state)

currently im doing the following:
While count < DS4.Tables(0).R ows.Count
While count2 < Me.Panel2.Contr ols.Count
If DS4.Tables(0).R ows(count)(0) =
Me.Panel2.Contr ols.Item(count2 ).Text.ToString Then

'NEED SOME CODE TO SET THE CHECKBOX WITHIN THE PANEL TO CHECKED

End If
count2 = count2 + 1
End While
count2 = 0
count = count + 1
End While

Basically im looping through a dataset to see if the value in the dataset
is the same as the text on a checkbox, if it is i need to set the checkbox
to checked, but i have no idea how to do it

Thanks

Mike Fellows

Jul 14 '06 #2
Hi Mike,
In your code, cbx and Me.Panel2.Contr ols.Items(count 2) are references to
the same object - what is the point in removing and then adding the same
checkbox to the collection?
Why don't you just:
Ctype(Me.Panel2 .Controls.Items (count2), CheckBox).Check ed = True

--
Terry
"Mike Fellows" wrote:
I managed to do this, very simply in all honesty

by doing the following

Dim cbx As CheckBox
cbx = Me.Panel2.Contr ols.Item(count2 )
cbx.Checked = True
Me.Panel2.Contr ols.RemoveAt(co unt2)
Me.Panel2.Contr ols.Add(cbx)

Thanks though

"Mike Fellows" <mi************ *@equityhouse.N OSPAM.co.ukwrot e in message
news:yL******** *************** *******@giganew s.com...
ok guys you have been a great help so far with this but im still
struggling

I have some programatically created checkboxes within a panel

how can i set a checkbox to be actually checked (i.e. change its state)

currently im doing the following:
While count < DS4.Tables(0).R ows.Count
While count2 < Me.Panel2.Contr ols.Count
If DS4.Tables(0).R ows(count)(0) =
Me.Panel2.Contr ols.Item(count2 ).Text.ToString Then

'NEED SOME CODE TO SET THE CHECKBOX WITHIN THE PANEL TO CHECKED

End If
count2 = count2 + 1
End While
count2 = 0
count = count + 1
End While

Basically im looping through a dataset to see if the value in the dataset
is the same as the text on a checkbox, if it is i need to set the checkbox
to checked, but i have no idea how to do it

Thanks

Mike Fellows


Jul 14 '06 #3
Because I didnt know how to do that

but that is much better than my way

Thanks


"Terry" <Te***@nospam.n ospamwrote in message
news:58******** *************** ***********@mic rosoft.com...
Hi Mike,
In your code, cbx and Me.Panel2.Contr ols.Items(count 2) are references to
the same object - what is the point in removing and then adding the same
checkbox to the collection?
Why don't you just:
Ctype(Me.Panel2 .Controls.Items (count2), CheckBox).Check ed = True

--
Terry
"Mike Fellows" wrote:
>I managed to do this, very simply in all honesty

by doing the following

Dim cbx As CheckBox
cbx = Me.Panel2.Contr ols.Item(count2 )
cbx.Checked = True
Me.Panel2.Cont rols.RemoveAt(c ount2)
Me.Panel2.Cont rols.Add(cbx)

Thanks though

"Mike Fellows" <mi************ *@equityhouse.N OSPAM.co.ukwrot e in
message
news:yL******* *************** ********@gigane ws.com...
ok guys you have been a great help so far with this but im still
struggling

I have some programatically created checkboxes within a panel

how can i set a checkbox to be actually checked (i.e. change its state)

currently im doing the following:
While count < DS4.Tables(0).R ows.Count
While count2 < Me.Panel2.Contr ols.Count
If DS4.Tables(0).R ows(count)(0) =
Me.Panel2.Contr ols.Item(count2 ).Text.ToString Then

'NEED SOME CODE TO SET THE CHECKBOX WITHIN THE PANEL TO
CHECKED

End If
count2 = count2 + 1
End While
count2 = 0
count = count + 1
End While

Basically im looping through a dataset to see if the value in the
dataset
is the same as the text on a checkbox, if it is i need to set the
checkbox
to checked, but i have no idea how to do it

Thanks

Mike Fellows



Jul 17 '06 #4

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

Similar topics

3
1430
by: Wendy S | last post by:
I have this working, but I don't think it's done efficiently or the best way: <a href="javascript:setAllAccounts(true)">check all</a> <a href="javascript:setAllAccounts(false)">clear all</a> function setAllAccounts(value) { for(i = 0 ; i < document.forms.accounts.length; i++ ) { document.forms.accounts.checked = value; } }
3
1179
by: Carl Mercier | last post by:
Hi, I have a long form that post back to itself at different places. At the very end, I have a button called "Next" that post back to itself again but some panels are hidden and some others are shown to simulate a "Next Page" effect. Since I have many controls that require post back, I need SmartNavigation to be turned on. However, when I press "Next" at the end of the page, the scroll position goes to the very bottom on the second...
1
1314
by: Carl Mercier | last post by:
Hi, I have a long form that post back to itself at different places (different controls). At the very end, I have a button called "Next" that post back to itself again causing some panels to be hidden and some others to be shown to simulate a "Next Page" effect. Since I have many controls that require post back, I need SmartNavigation to be turned on. SmartNavigation should work for all controls on my page, EXCEPT for the Next button...
2
1435
by: Suma | last post by:
I have a problem with editable datagrid and was hoping if anyone could help me. Please help me if possible. I have an editable datagrid, whose column count I don’t know until runtime. I am sure of 3 columns Id,Name and Description. But there also might be more. So I add these 3 columns and an editcommandbutton and deletecommnadbutton at design time. Then during runtime I insert my other columns that I need, in between
1
2203
by: Dino Buljubasic | last post by:
Hi, I am using C# VS2005 and I am having a problem that I did not notice before in VS2003. I have created myUserControl that contains a Panel. The panel is loaded dynamically with a number of ListViews. The number depends on the size of the form (therefore the size of the panel which is anchored to resize when form is resized.
8
7775
by: Rak | last post by:
I am looking for a way to programatically change the .net version of the virtual directory that I am creating within a aspx page. As part of creating a new customer in my asp.net 2 application, it automatically creates a virtual directory and configures it. I am using the DirectoryServices.DirectoryEntry class in C# to do this. I am unable to set the .Net version of the virtual directory from 1.1 to version 2. All searches led me to the...
5
8401
by: Mike Fellows | last post by:
I have created some checkboxes within a panel using the code below Dim NewCheckbox As New CheckBox Me.Panel2.Controls.Add(NewCheckbox) NewCheckbox.Location = New Point(XLocation, YLocation) NewCheckbox.AutoSize = True NewCheckbox.Text = DS1.Tables(0).Rows(counter1)(0) NewCheckbox.Name = "Checkbox" & counter1 + 1
10
5208
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named 'CheckAllRows' on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the...
0
996
by: rhyspatto | last post by:
Hi, I have a problem but cannot figure out a good solution to it. I am trying to create a form that creates a bunch of panels during runtime, and I want to be able to send commands (such as false visibility, etc) to the panels also during runtime. Once I create a bunch of panels (each using the same 'creation' code), how can I call them up again to send commands to them? I figure I can add them to an array and call them using:...
0
9591
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
9425
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,...
1
10002
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9869
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...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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.