TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Syaiful Muhammad
NA
54
434
Passing of a dynamic checked box to another box.
Feb 5 2021 7:41 AM
Hi, I am new to this. i would like to pass over checked values from form1 to form2 however i am currently using the dynamic checkbox, thus the output i would like use for another sql query in form2.
Here is my code:
private
void
populateSalesCategory()
{
con.Connect();
string
selectQuery =
"SELECT * FROM SalesCategory"
;
using
(SqlDataAdapter sda =
new
SqlDataAdapter(selectQuery, con.conn))
{
//Fill the DataTable with records from table
DataTable scdt =
new
DataTable();
sda.Fill(scdt);
//Loop and add CheckBoxes to SalesCategoryPanel.
string
sc =
""
;
foreach
(DataRow row
in
scdt.Rows)
{
CheckBox chk =
new
CheckBox();
chk.Width = 100;
chk.Text = row[
"CategoryName"
].ToString();
chk.CheckedChanged +=
new
EventHandler(changecheck);
salesCategoryPanel.Controls.Add(chk);
}
}
}
private
void
changecheck(
object
sender, EventArgs e)
{
CheckBox chk = sender
as
CheckBox;
if
(chk.Checked)
{
MessageBox.Show(chk.Text);
}
}
Thanks a lot.
Reply
Answers (
1
)
Capture image using multiple computer at same time.
How to create Json according to below Schema