Why do i cannot use Convert.ToXXX in window application?

kpao

Active member
Joined
Apr 3, 2006
Messages
29
Programming Experience
Beginner
I'm developing a window application. However, when I'm using Convert.ToChar() method, The error occured and the message is the following:
Overload resolution failed because no accessible 'Convert' accepts this number of arguments.

I've tried using another convert. the result is the same whatever i used Convert.ToByte, Convert.ToInt16, etc.

What's the problem with this convert function?
 
There's nothing wrong with the convert function, just the way that you are using it. The error msg is pretty descriptive in this case. You have't supplied it with the correct amount of arguments.

VB.NET:
Convert.ToString('Something you want to convert')
 
There's nothing wrong with the convert function, just the way that you are using it. The error msg is pretty descriptive in this case. You have't supplied it with the correct amount of arguments.

VB.NET:
Convert.ToString('Something you want to convert')

Have you ever tried this function in VB.Net window applicaion?
VB.NET:
Convert.ToString('Something you want to convert')
It is not a legal syntax because 'Something you want to convert' is a comment in VB.Net. I've tried to correct to
VB.NET:
Convert.ToString("Something you want to convert")
It still doesn't work.
 
You have completely misunderstood what vis781 was trying to tell you. You wouldn't pass a string to Convert.ToString because where's the point in converting a string to a string. vis was implying that you would put some object there of the appropriate type. As vis says, there is nothing wrong with the method, only the way you're using it. Did you actually stop to read the error message? It's telling you that you are passing too many arguments. Given that you haven't even bothered to post the code that you're using it's a little hard to be any more specific than that. All you need to do is pay attention to Intellisense. It will tell you exactly what you can and can't pass to any method. Once you type "Convert.ToString(" into the code window Intellsense will kick in and show you the method signature, including any overloads, as well as a description of the method and the current argument. You can use the arrow keys or the mouse to scroll through the overload list and see all the legal parameters. It was all there in front of you had you just slowed down and taken notice.
 
Back
Top