How to use System.String?

yukon
Member Posts: 361
Hi Team,
I'm trying to use System.String in NAV2009-R2. I can't assign value to System.String variable. I refered the function "IsValidFileName" of NAV 2013 CU-419(File Management). But 2013 can assign the value. Why can't use in NAV2009-R2? Is it something wrong in my code?
Best Regards,
Yukon
I'm trying to use System.String in NAV2009-R2. I can't assign value to System.String variable. I refered the function "IsValidFileName" of NAV 2013 CU-419(File Management). But 2013 can assign the value. Why can't use in NAV2009-R2? Is it something wrong in my code?
Name DataType Subtype Length String DotNet 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.String String := 'balabala'; --------------------------- Microsoft Dynamics NAV Classic --------------------------- Assignment is not allowed for this variable.
Best Regards,
Yukon
Make Simple & Easy
0
Answers
-
Try adding this code:
IF ISSERVICETIER THEN string := 'balabala' // should work if running on the application tier, untested ELSE MESSAGE('Classic client does not support dotnet, use RTC');
0 -
Have you tried to use Constructor first to create the string object?0
-
Hmmm... yes, the problem with abiquity in different forms of the constructor...
There are changes in the dotnet interop in NAV 2013 and it looks like they solved some basic problems of the DotNet from 2009. Looks like you hit one...0 -
Hi Kine,
I think some .net variable cannot use directly in NAV. I found at this blog http://navigateintosuccess.com/blog/generics-in-net-interop-for-nav-2013.
Best Regards,
YukonMake Simple & Easy0 -
I had the same scenario that I needed System.String and the method replace.
But I managed to find a workaround by using stringbuilder instead
StringBuilder := StringBuilder.StringBuilder(String);
StringBuilder.Replace('MyOldValue', 'MyNewValue');
F.WriteAllText(FileName, Stringbuilder.ToString);Hello IT, have you tried to turn it off and on?
Have you checked the cables?
Have you released the filters?
http://www.navfreak.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions