locked
How to convert from type to type RRS feed

  • Question

  • Hi all ,,,

    I'm facing troubles from converting from one type to another , I have errors in this codes:

    Dim objStreamReader As New StreamReader("\program files\missed_calls\Settings.xml")
                    Dim p As New MySettingsClass()
                    Dim x As New XmlSerializer(p.GetType)
                    p = x.Deserialize(objStreamReader)
    'Implicint conversion from Object to Missed_Calls.MySettingsClass
                    objStreamReader.Close()
    
    
    MsgBox("There is no selected item to remove !", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Select Item First")
    
    'Implicint conversion from integer to Microsoft.VisualBasic.MsgBoxStyle
    
    
    Another question :
    to convert from Decimal to Integer , Do I use Cint , Ctypt(Decimal,Integer)
    
    
    
    Many thanks in advance.
    Monday, March 29, 2010 3:03 PM

Answers

  • Hi ashraf,

    Like you said, both Cint and Ctype  are OK, both work. Here is my test result:

    Dim i As Double = 2.0

            Dim j As Integer = CInt(i)

            Dim n As Integer = CType(i, Integer)

     

            Dim m As Integer = CInt(MsgBoxStyle.Critical)

    Both work fine in my local.

     

    If you still have question, please let me know.

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, March 31, 2010 3:36 AM

All replies

  • Hi ashraf,

    Like you said, both Cint and Ctype  are OK, both work. Here is my test result:

    Dim i As Double = 2.0

            Dim j As Integer = CInt(i)

            Dim n As Integer = CType(i, Integer)

     

            Dim m As Integer = CInt(MsgBoxStyle.Critical)

    Both work fine in my local.

     

    If you still have question, please let me know.

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, March 31, 2010 3:36 AM
  • Many thanks Guang for your reply , it's really appreciated and helpfull.
    Wednesday, March 31, 2010 4:27 AM