Using Format function in compiled code

a1683

New Member
Hi,<BR><BR>Can anyone tell me why the line: <BR><BR> Dim strdd as String = Format(objDetails.PostedDate, "dd")<BR><BR>which worked perfectly on an aspx page, produced the following error when I put it in a .vb page and tried to compile it:<BR><BR> C:InetpubwwwrootDatabase.vb(550) : error BC30451: Name 'Format' is not declared.<BR> Dim strdd as String = Format(objDetails.PostedDate, "dd")<BR> <BR><BR>Do you have to import a namespace or something like that?<BR><BR>Thanks,<BR><BR>JONDon't worry, I just figured it out! I had to add:<BR><BR>Imports Microsoft.VisualBasic<BR><BR>to the .vb file, and then it compiled fine.<BR><BR>JON
 
Back
Top