Solved

Explenation needed about a methode

Posted on 2011-09-27
7
190 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

11 Experts available now in Live!

Get 1:1 Help Now