Hi,
Only we have to change SUB to function, every end of statement we have to give ; and we have to declare data types int,string and ... instead of Dim.
check this this code, it will help you,
function CTRL2_5::OnClick(eventObj)
{
string txtPath;
string txtName;
string GMSRef;
GMSRef = XDocument.DOM.selectSingleNode("my:myFields/my:field2").text;
txtPath = "Z:\My Documents\InfoPath Forms\";
txtName = ".xml";
XDocument.SaveAs(txtpath & GMSRef & txtName);
thisXDocument.Application.Close(true);
}
I hope this will help you.
K.Ramana Reddy / http://www.ggktech.comIndia.