Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Explenation needed about a methode

Posted on 2011-09-27
Medium Priority
200 Views
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
Question by:peterkiers
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 15

Expert Comment

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

Bill Nolan earned 800 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

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

P.
0

LVL 15

Accepted Solution

Eyal earned 800 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

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

LVL 8

Assisted Solution

jagrut_patel earned 400 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

ID: 36708571
Thanks for the information.

Peter Kiers
0

## Featured Post

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
###### Suggested Courses
Course of the Month11 days, 8 hours left to enroll