Solved

Explenation needed about a methode

Posted on 2011-09-27
7
191 Views
Last Modified: 2013-12-17
Hi,
Can someone translate this for me, the most easiest way.
Because I am terrible in math:

        private void SizeLastColumn(ListView lv)
        {
            int x = lvNotes.Width / 15 == 0 ? 1 : lvNotes.Width / 15;
            lvNotes.Columns[0].Width = x * 2;
            lvNotes.Columns[1].Width = x;
            lvNotes.Columns[2].Width = x * 2;
        }

Peter
0
Comment
Question by:peterkiers
7 Comments
 
LVL 15

Expert Comment

by:Eyal
ID: 36708492
put in x 1 if listview width divided to 15 is zero otherwise put the devision result
resize the columns:
0 -> x by 2
1 -> x
2 -> x by 2
0
 
LVL 7

Assisted Solution

by:Slimfinger
Slimfinger earned 200 total points
ID: 36708510
Column 1 will be width 'x', which is 1 unit wide for every 15 of lvNotes.Width, minimum of 1.
Column 0 & 2 will be twice the width of column 1.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36708520
What the purpose of the ?-sign. What does that mean?

P.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 15

Accepted Solution

by:
Eyal earned 200 total points
ID: 36708537
its a method to write if else in one row

same as writing...
if(lvNotes.Width / 15 == 0)
{
x=1;
}
else
{
x=lvNotes.Width / 15;
}
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36708555
Oke only thing i don't get is the function of the ? sign.
0
 
LVL 8

Assisted Solution

by:jagrut_patel
jagrut_patel earned 100 total points
ID: 36708561
?: is like if..else condition

(condition)?(value if condition is true): (value if condition is false);
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36708571
Thanks for the information.

Peter Kiers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now