Message 1 of 2
how new th file and open it.

Not applicable
02-19-2008
05:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to new file in user input “new”,and opened this file.
What event?or make there?
This section of code below ,it can't Application.DocumentManager.Open. If opening will make a mistake.
private void OnDocumentCreated( object sender, DocumentCollectionEventArgs e )
{
if (!e.Document.Name.ToUpper().Contains("\\"))
{
string DOCNO = "";
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);
string secFildeName = ".dwg";
string FilePath = "C:\\";
if (DOCNO != "")
{
Database db = new Database();
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest);
db.Dispose();
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);
//Application.DocumentManager.MdiActiveDocument = doc;
}
}
}
This section of code below , it can Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);
But “new” at new file,it’s not working.
Document doc = Application.DocumentManager.MdiActiveDocument;
doc.CommandEnded += new CommandEventHandler(cmdEnded);
public void cmdEnded(object o, CommandEventArgs e)
{
if (e.GlobalCommandName.ToUpper().Contains("NEW"))
{
string DOCNO = "";
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);
string secFildeName = ".dwg";
string FilePath = "C:\\";
if (DOCNO != "")
{
Database db = new Database();
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest);
db.Dispose();
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);
//Application.DocumentManager.MdiActiveDocument = doc;
}
}
}
Best Regards
What event?or make there?
This section of code below ,it can't Application.DocumentManager.Open. If opening will make a mistake.
private void OnDocumentCreated( object sender, DocumentCollectionEventArgs e )
{
if (!e.Document.Name.ToUpper().Contains("\\"))
{
string DOCNO = "";
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);
string secFildeName = ".dwg";
string FilePath = "C:\\";
if (DOCNO != "")
{
Database db = new Database();
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest);
db.Dispose();
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);
//Application.DocumentManager.MdiActiveDocument = doc;
}
}
}
This section of code below , it can Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);
But “new” at new file,it’s not working.
Document doc = Application.DocumentManager.MdiActiveDocument;
doc.CommandEnded += new CommandEventHandler(cmdEnded);
public void cmdEnded(object o, CommandEventArgs e)
{
if (e.GlobalCommandName.ToUpper().Contains("NEW"))
{
string DOCNO = "";
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);
string secFildeName = ".dwg";
string FilePath = "C:\\";
if (DOCNO != "")
{
Database db = new Database();
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest);
db.Dispose();
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);
//Application.DocumentManager.MdiActiveDocument = doc;
}
}
}
Best Regards