473,383 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Updating the checkstate of dynamically added checkboxes

I have been able to add controls dyanmically to a windows application.
And I can get the Click event working beautifully. But now I want to
use an another event to change the state of the check box but I can
seem to figure out how to work with the control.

So in the code below I create a bunch of check boxes and I want the
event called IFK_InputChange (where I have an external hardware device
that I use as IFK, it works no problems) to update the chkInput check
boxes that I have created.

Any suggestions would be appreciated.

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load

End Sub

Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
For i As Integer = 0 To IFK.GetNumInputs - 1
Dim chkInput As New CheckBox
chkInput.Location = New Drawing.Point(110, 170 + i * 20)
chkInput.TabIndex = i
chkInput.Tag = i.ToString
chkInput.Name = "input" + i.ToString
chkInput.Text = chkInput.Tag.ToString
AddHandler chkInput.Click, AddressOf ClickInputs
Controls.Add(chkInput)
Next

End Sub

Private Sub ClickInputs(ByVal sender As Object, ByVal e As
EventArgs)
MessageBox.Show("Clicked was " & DirectCast(sender,
CheckBox).Tag.ToString)
End Sub

Private Sub IFK_InputChange(ByVal sender As Object, ByVal e As _
InputChangeEventArgs) Handles IFK.InputChange
MessageBox.Show(e.getIndex & " is " & e.getState)
End Sub

End Class

Mar 9 '06 #1
0 825

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

Similar topics

0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
3
by: Punisher | last post by:
I'm adding checkbox controls to a table dynamically when the form loads for the first time. When a postback occurs, the controls are not maintained in the table. How do I get them to retain...
4
by: epigram | last post by:
I've got a page that has a Panel object that I am dynamically adding CheckBox controls to. The number of CheckBox controls and the name of each control is based on a database query. I would like...
2
by: david | last post by:
I have no idea how to get the IDs of dynamically genrated CheckBoxes and the events of CheckedChange. I have dynamically generated array of CheckBoxes, checkboxes,which dynamically display in a...
2
by: Pete Moss | last post by:
During a postback event, I am having trouble retrieving the state of a CheckBox Control that I am dynamically adding to a DataGrid Control using ASP.NET 1.1. I have no trouble adding the...
2
by: showens | last post by:
I have a table that has rows appended dynamically, based on the item selected from a dropdownlist. The rows have a number of cells, one with a literal control using the text of the dropdownlist,...
2
by: somaskarthic | last post by:
Hi In my php code , i dynamically created table rows on button click event. Each row contain 3 selectboxes, 7 checkboxes . On each click of these elements i need to submit the form and save the...
12
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
1
by: myth0s | last post by:
Hello, I have a .aspx page (VB.NET) where there is the following table : <asp:Table ID="mainTable" CssClass="tableList" runat="server"> <asp:TableHeaderRow CssClass="tableHeader"> ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.