String.format

Hi

I’m still at an early learnig stage so forgive me if my terminolgy is not correct.

I’m using a t35 display to display some text strings in a WPF window. I want to pad the strings so that dispaly looks like a tabbed list.

I can get the strings to display OK but I’m now trying to format them using String.Format to pad the string as follows:



But when I type 'String.'  I dont get the format option. 

Do I need a specific 'using'  reference to be able to use the string.fromat command?

The list of 'using' directives at top of my code is as follows:-


```cs
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;
using GHI.Premium.Hardware;
using Microsoft.SPOT.Input;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

Many thanks

Paul

 is not implemented in NETMF. You have to do formatting yourself.
1 Like

Ah Ha, that solves my problem, thankyou

Is there a complete list of core ‘commands’ etc that are implemented in netmf anywhere? I already understand the need to load hardware specific references.

I’m looking in the API Reference for .NET Micro Framework (API Reference for .NET Micro Framework | Microsoft Learn) which details the format.string commmand

Sorry for all the questions

Paul

Don’t overlook ToString as you can put some formating in it eg (someNumber.ToString(“F3”)

The NETMF documentation for the most part is accurate and if something is not listed there then it is not implemented. I don’t see documentation about Format method. Where did you find it?

I’m dealing with a float, so Single class docs had it…


float f = -1.91482E-06f;
string v = f.ToString("G");
Debug.Print(v);

Result is “-1.914819968e-6”

Also String.Concat is quite useful here.
It accepts an ‘unlimited’ number of object arguments and concatenates these using the Object.ToString() value of each object.