Formatting & Data Binding

  • Thread starter Thread starter Shmulik
  • Start date Start date
S

Shmulik

How can I bind to a data source and express a format?

For example:

Let's say I have a function that returns an array of double, like so:
double[] myVals= MyFunctions (param1, ..., paramN);

I want to view the data in a listBox, but I'd like the data to only show n
digits, something like:

listBox1.DataSource = MyVals.ToString("2F"); // I know you can't do
this !!

Hold do I set the numeric formatting type for the listBox?
 
Shmulik said:
How can I bind to a data source and express a format?

For example:

Let's say I have a function that returns an array of double, like so:
double[] myVals= MyFunctions (param1, ..., paramN);

I want to view the data in a listBox, but I'd like the data to only show n
digits, something like:

listBox1.DataSource = MyVals.ToString("2F"); // I know you can't do
this !!

Hold do I set the numeric formatting type for the listBox?

Use listbox1.DataTextFormatString to format the data.

Frans



--
 
Back
Top