object reference error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am starting to realize that there are differences in vb.net and c#:
in terms of syntax, object and keyword in small or big letter

In the routine below, I got this error message in c
An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Page.MapPath(string)

But I would not get an error messaage if this same code is converted in vb. Please help. I am new in c#

private static void getnow(string dfilename)
XmlDocument docc = new XmlDocument()
docc.Load(MapPath( string.Concat("/virtualdirectory/", dfilename)))
....


Ra
 
Just remove the static wor
It will work because it is no longer a constan

private void getnow(
instead of private static void getnow(
 
Back
Top