Showing posts with label handle. Show all posts
Showing posts with label handle. Show all posts

Monday, March 26, 2012

String/Listbox question

I'm trying to get a handle on C#, but it's frustrating me - in vb.net, I can say:

Dim lbText as string
lbText=Listbox1.SelectedItem.Text

but in C#, I try:
string lbText = listBox1.SelectedItem.ToString;

and I get an error:
Cannot convert method group 'ToString' to non-delegate type 'String'

I don't get it - how can I convert the selected item in the listbox (or dropdownlist) to a string?

I guess something like this:

string mySelectedText = ListBox1.SelectedItem.Text;

StringBuilder AppendFormart cannot handle String!

Hello,

If I use AppendFormat with string as a parameter.
I get string cannot be converted to IFormatProvider.

This occurs in 2.0

Thanks.
JayIt might be the actual format that's invalid, not the parameter. Perhaps an
example of code that doesn't work would help...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Jay Balapa" <jbalapa@.hotmail.com> wrote in message
news:eZplPbsGGHA.1100@.TK2MSFTNGP10.phx.gbl...
> Hello,
> If I use AppendFormat with string as a parameter.
> I get string cannot be converted to IFormatProvider.
> This occurs in 2.0
> Thanks.
> Jay

StringBuilder AppendFormart cannot handle String!

Hello,
If I use AppendFormat with string as a parameter.
I get string cannot be converted to IFormatProvider.
This occurs in 2.0
Thanks.
JayIt might be the actual format that's invalid, not the parameter. Perhaps an
example of code that doesn't work would help...
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
"Jay Balapa" <jbalapa@.hotmail.com> wrote in message
news:eZplPbsGGHA.1100@.TK2MSFTNGP10.phx.gbl...
> Hello,
> If I use AppendFormat with string as a parameter.
> I get string cannot be converted to IFormatProvider.
> This occurs in 2.0
> Thanks.
> Jay
>