Visual Studio 2008

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • notfreeusername
    New Member
    • Jan 2010
    • 2

    Visual Studio 2008

    I built a program of Visual Studio 2008. It's all right.

    But I have a little problem, i got a little Debugg how to fix it ?



    It's my function:
    Code:
    Private Function BinaryNbr(ByVal calc As Long) As String
            Dim value As String, exp As Integer
            value = "00000000000000000000000000000000"
            Do
                If calc And ExpUp(exp) Then
                    Mid$(value, 32 - exp, 1) = "1"
                    calc = calc Xor ExpUp(exp)
                End If
                exp = exp + 1
            Loop While calc
            BinaryNbr = Mid$(value, 33 - exp)
        End Function
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    The error is telling you that it is not possible to cast the string to a number.
    How would you? What would be the numerical value of the word "cat"? Would a "cat" be equal to 7, a "dog" be equal to 9, a "horse" be equal to 14?

    You can try to convert a string such as "4" to a number 4, but if the string cannot be converted then it throws and exception, so you put it into a try/catch block.

    Convert.ToDecim al(string VariableName);

    Comment

    • notfreeusername
      New Member
      • Jan 2010
      • 2

      #3
      Can you fix it in my code, because I couldn't do this 3 days... ?

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        A) I don't write in VB. I am a C# guy.
        B) I've already pointed you to the function you need. Take 5 minutes to experiment with it.

        If you can't be bothered with learning or experimenting with a new function that you were already given then maybe it's time to tell your boss that you don't have the training to complete this project. It might be the nudge (s)he needs to get you some more training which can only further your career.

        Either that or your company needs to quit underbidding qualified coders on projects that they don't have the expertise to handle - because it is unfair to their staff (you) to expect results they aren't prepared to produce. Nobody needs that kind of pressure placed upon them. It just makes people miserable.

        Take a look at the link I sent you and the method that I already showed you. Experiment with it. Trial and error. I'm not saying take 3 days on it, but at least give it 2 hours. If you give it an honest effort and still can't get it, then post the code that you have tried and someone here should be able to help your understanding of the function so that you *learn* instead of blindly *copy/paste*.

        Comment

        Working...