Help: Converting short to string (and visa versa)

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

How can I do this (both ways)?

I've tried this: MessageBox.Show(Convet.ToString(MyShortVar));

But it fails telling me I have invalid arguments for Show.
 
string str;
short i;

str = i.ToString();
i = short.Parse(str);
 
How can I do this (both ways)?

I've tried this: MessageBox.Show(Convet.ToString(MyShortVar));

But it fails telling me I have invalid arguments for Show.

You might want to check the MessageBox.Show-method in your MSDN lib...
I'm sure you haven't yet...

as far as converting myShortVar to a string:
MyShortVar.ToString();
Convert.ToString(MyShortVar);
(string)MyShortVar;
 
NULL said:
(string)MyShortVar;

This one will fail at compile time - there's no implicit or explicit
conversion (in a language sense) from short to string.

Short.ToString, Convert.ToString, or String.Format are the way to go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top