Results 1 to 7 of 7

Thread: wierd error

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    wierd error

    Hi

    This is WIERD!!!!

    If i run the app within the IDE or even within the device itself, there is no error! however if i run the app within Windows... it gives me the arguement out of range exception saying that the length cannot be less than zero.

    All I am doing is this:

    Assembly.GetExecutingAssembly().GetName().FullName


    from that I get the error ONLY IN WINDOWS.... NOT in the IDE or the mobile device

    any ideas?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: wierd error

    Are you absolutely sure that that is the line that is throwing the exception? There is no argument and there is nothing with a Length property so I don't see how it could be. Having said that, you cannot just have that as a line of code because FullName is a property so you have to either assign it to a variable or assign a value to it, which is not possible in this case because it is ReadOnly. Are you trying to assign this string to an element of an array that is of length zero? I'd suggest putting MessageBoxes on either side of that line just to confirm that it is actually the one that is throwing the exception.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: wierd error

    it is throwing an exception and I have tried this.
    That value/command I assign to a string variable Ths works within the IDE and on the mobile device but NOT on the PC....

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: wierd error

    That does seem awfully odd. Why don't you try breaking it up into three seperate operations like this and see what happens:
    VB Code:
    1. Dim myAssembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
    2.         Dim myAssemblyName As Reflection.AssemblyName = myAssembly.GetName()
    3.         Dim myString As String = myAssemblyName.FullName
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: wierd error

    tried that too and i still get the error

    I mean its ok because it runs fine on the mobile device and thats what it was made to do... to run on the mobile device using the smartphone application project..... so if people run on the computer - it is not meant to work 100% (even though it was before I put on that command)....

    It is interesting....

    is there a way to detect if the app is running from a computer or mobile device?

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: wierd error

    I guess you could check which version of the .NET Framework it is using, which should tell you whether it is the CF or not. I don't actually know how to do that but I can't imagine that it's too difficult. Out of interest, which of the three lines was the one throwing the exception when you broke it up?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: wierd error



    its at the first line.... and if i comment out the first line.. then the second line...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width