Posts: 15
Registered: ‎08-09-2013
Message 1 of 3 (163 Views)


163 Views, 2 Replies
08-22-2013 05:16 AM

Dim filename As String = "Test.txt"
Dim fullPath As String
fullPath = Path.GetFullPath(filename)
MsgBox("GetFullPath('{0}') returns '{1}'", _
filename, fullPath)


i try it but it has error on ((MsgBox("GetFullPath('{0}') returns '{1}'", filename, fullPath)))

Conversion from string "Desktop\Layer Data\Test.txt" to type 'Integer' is not valid.


want to get the path of the test.txt


what can i do 

*Expert Elite*
Posts: 1,017
Registered: ‎04-27-2009
Message 2 of 3 (154 Views)

Re: path.Getfullpath

08-22-2013 06:52 AM in reply to: hoyin0820

Well, to me it is another sample of VB doing much on behalf of user behind the scenewhile "Option Strict" is not turned on (by default). If "Option Strict" is turned on, the compiling would have failed on the line of code: the parameters you passed to MsgBox, the second one, is wrong. It should be a MsgBoxStyle enum value - an integer, indicating the button(s) showing, such as OKOnly, YesNo,...Thus the error message. If you use C#, you'll never be puzzled by such low level error, the compiler always causes it.


MsgBox function does not have the same method signature as Strinig.Format(), or Editor.WriteMessage(), as your code shows.


In your code, you should


Dim msg As String=String.Format("GetFullPath('{0}') returns '{1}'", fileName,filePath)

MsgBox(msg, MsgBoxStyle.OkOnly,"My Message")


*Expert Elite*
Posts: 1,285
Registered: ‎06-21-2004
Message 3 of 3 (150 Views)

Re: path.Getfullpath

08-22-2013 07:10 AM in reply to: hoyin0820



(defun botsbuildbots() (botsbuildbots))
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.