Solved

Explenation needed about a methode

Posted on 2011-09-27
7
197 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
[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
  • Learn & ask questions
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:Bill Nolan
Bill Nolan 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

615 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