locked
String Convert To Double RRS feed

  • Question

  • hi, i have trouble with converting. I have a txt file, with function split i get an array, but variables of array only string type.

    I need Double type, because colums at table in this type.

    i'm wroute this code but system show me exception of converting

    (visualBasic)

    Dim path_hnames As String = "My Documents\hnames.txt"Using sr As System.IO.StreamReader = System.IO.File.OpenText(path_hnames)
    Do While sr.Peek() >= 0
       Dim MyArray() As String
    MyArray = Split(sr.ReadLine(), "::")
    Dim M1 As Double
    Dim M3 As Double
    Dim M7 As Double

    M1 = Convert.ToDouble(MyArray(1))
    M3 = Convert.ToDouble(MyArray(3))
    M3 = Convert.ToDouble(MyArray(7))

    GoodsTableAdapter.CicleIns(MyArray(0), M1, MyArray(2), M3, MyArray(4), MyArray(5), MyArray(6), M7)

    Monday, June 28, 2010 2:12 PM

Answers

  • The following thread will help you fix the "Could not find resource assembly" issue, so that you can get a meaningful description about the exception.

    http://social.msdn.microsoft.com/Forums/en/windowsmobiledev/thread/b9489d70-eed5-4840-9e34-b385abab80fc 

    I would suggest that you debug your application step by step, check the values of the strings you are trying to convert, and make sure they are convertable to double type. Besides, you should always try/catch the conversion code to deal with invalid inputs.


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by warrentang Friday, July 2, 2010 2:44 AM
    Wednesday, June 30, 2010 8:34 AM

All replies

  • Which exceptions (include exception type, stack trace and exception message if any)? In which line? On which data (include values of all variables used in that line)?
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, June 28, 2010 4:19 PM
  • Message text unavailable. Resource file 'Microsoft.VisualBasic resources' not found.

    This message on  Dim M1 As Double. What it mean? At home this line works :)

    But on line M1 = Convert.ToDouble(MyArray(1)) he say, that message couldn't show......

    Tuesday, June 29, 2010 6:24 AM
  • Sorry, can't help you as you failed to provide information I requested.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, June 29, 2010 6:37 AM
  • in split string only numbers at all, i need insert this numbers to table, and table column have  double format.
    Tuesday, June 29, 2010 6:40 AM
  • The following thread will help you fix the "Could not find resource assembly" issue, so that you can get a meaningful description about the exception.

    http://social.msdn.microsoft.com/Forums/en/windowsmobiledev/thread/b9489d70-eed5-4840-9e34-b385abab80fc 

    I would suggest that you debug your application step by step, check the values of the strings you are trying to convert, and make sure they are convertable to double type. Besides, you should always try/catch the conversion code to deal with invalid inputs.


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by warrentang Friday, July 2, 2010 2:44 AM
    Wednesday, June 30, 2010 8:34 AM