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
Murali Kris
1.5k
254
48.4k
How to apply Best way for Logical Condition here.
Nov 22 2018 1:24 AM
Hi All,
Can someone help here how to do i apply condition logical condition between more operands
ex. int a,b,c,d,e,f,g,h //just for test purpose i took here alphabets infact i have checkbox more that 10 checkbox controls in winForm
if(a.checked == true && b.checked == true &&
c.checked== true && d.checked== true && e.checked== true &&)
{
dt.Columns.Add("List-A", typeof(string));
dt.Columns.Add("List-B", typeof(string));
dt.Columns.Add("List-C", typeof(string));
dt.Columns.Add("List-D", typeof(string));
dt.Columns.Add("List-E", typeof(string));
etc...
}
if(a.checked == true && b.checked == true &&
c.checked== true && d.checked== true)
{
dt.Columns.Add("List-A", typeof(string));
dt.Columns.Add("List-B", typeof(string));
dt.Columns.Add("List-C", typeof(string));
dt.Columns.Add("List-D", typeof(string));
}
if(a.checked == true && b.checked == true &&
c.checked== true)
{
dt.Columns.Add("List-A", typeof(string));
dt.Columns.Add("List-B", typeof(string));
dt.Columns.Add("List-c", typeof(string));
}
if(a.checked == true && b.checked == true)
{
dt.Columns.Add("List-A", typeof(string));
dt.Columns.Add("List-B", typeof(string));
}
if(a.checked == true)
{
dt.Columns.Add("List-A", typeof(string));
}
here windows form application i am providing UI with multiple checkboxes, if user checked the checkbox I would like to add only those columns into datatable.
i am sure this is not right way apply logical condition over operands, i though of i would like to reduce lines of code with better way to check.really dont know how to apply logical condition between more than 3 operands.{(if((a>b)&&(a>c))} i just applied this format here but need assist here for better way.
kindly write with complete code(with above code) for apply logical condition here to make dynamic data table columns.
Thanks,
Murali krishna.
Reply
Answers (
2
)
State Management
Have sentense with more than 10 words i want to do the count