I am trying to open an mxd in an ESRI ArcMap add-in using vb.net. The user starts with a blank mxd and runs a tool to open an mxd that is stored in a file. The mxd that is opened by the code has some feature layers and some graphics in the layout.
So far I have:
Dim mapdoc As IMapDocument = New MapDocumentClass()
mapdoc.Open("D:\__Test\LockItInPMAV.mxd")
The document opens because I can get its filename via:
MsgBox("Filename: " & mapdoc.DocumentFilename)
However the data view and layout view remain blank, they do not show the contents of the opened file.
How can I get the opened file to display in the current ArcMap session?
Thanks,
Luke.
I'm working in C#. I'm not sure if you can load an mxd after it is loaded.
You would either need to load a new arcmap instance and pass the mxd name as a parameter:
var expanPath = Environment.GetEnvironmentVariable(Properties.Settings.Default.arcmapLaunchPath,
EnvironmentVariableTarget.Machine);
string Cmd = string.Format(#"{0}\arcmap.exe", expanPath);
ProcessStartInfo startInfo = new ProcessStartInfo(Cmd);
startInfo.Arguments = Properties.Settings.Default.MxDPath;
Process.Start(startInfo);
Process.GetCurrentProcess().Kill();
The MXD holds so much details on how the instance of arcmap operates that it is not easy to reload it. Our esri contractor confirmed this.
I am told that Pro, has changed this completely.
Related
I have some custom popup menus in my app and i am tired of using the .FaceID property just to set some "not so relevant" images form my commands. What i want to do is to get some pictures saved in a local table OLE-OBJECT field and display those instead of the MS pictures.
The controls of commandbar object have .Picture and .Mask properties which work just fine if i load a file from the hdd into a IPictureDisp object using stdole.LoadPicture, but i don't want to have hundres of small files in my app folder.
So, my question is: is there a way i can get the picture saved in the local table to become a IPictDisp. I can get it's byte array just fine, but i found no way of converting that into something that the Commandbar button can recognize.
Thank you for any help.
Is it possible to download a file using MVC4 to iPad instead of showing the file in the browser when clicked?
On my webpage, I am showing a table of files (can be any type) and when clicked on the file names, the file should be downloaded to the iPad.
I am using:
Public Sub GetItem(ByVal fileId As Guid)
Dim sDirectory As String = Commands.Folder.MapFullPath(fileId)
sDirectory = ApplyClusterServerHACK(sDirectory)
Me.HttpContext.Response.Clear()
Me.HttpContext.Response.ContentType = "application/octet-stream"
Me.HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename=" & System.IO.Path.GetFileName(sDirectory))
Me.HttpContext.Response.TransmitFile(sDirectory)
Me.HttpContext.Response.End()
End Sub
to get the file and it's working perfectly in desktop browsers. It is prompting if I want to open it or save it, and choosing save opens up the location dialog box where I can select where to save it.
Can this be done in an iPad? If not, do you have any alternate idea how to make it work? Using the Back button on the browser is off-limits since I am running the application full-screen using a "stub" without any menu bars.
I am working on creating multiple documents from source document.
I am using:
objWordApp.Documents.Open("D:\Template\Aptletter.doc")
I modify the above document and save in another folder.
While creating documents, word files are opening and closing multiple times. So user unable to do another work on the same PC.
How to stop open file or Is there any method to modify document without above method?
So please suggest
Thanks in Advance
DEV
The visibility of a word document being controlled via interop can be set using the WordApplication.Visible attribute.
This attribute is, as you can see, at the Application level. If you've already opened a document using that WordApplication, you can't suddenly make the application invisible using the attribute.
What you can do, though, is create another instance of WordApplication. Call it InvisibleWordApplication for clarity, and set InvisibleWordApplication.Visible = false right from the start. Then open your document using that application, and you should be set.
I need to copy an image from a webbrowser control to my clipboard, because the image changes on every reload, and I tried to get the "src"-attribute and changing my picturebox.imagelocation to that, but the image on the picturebox differed from the picture on the webbrowser control.
I'm trying to automate a web service, and it requires a captcha to be filled out, and it changes every time the page is loaded, that's why I need to get the one that is currently displayed.
Assuming you are using Windows Forms (need to change the way to get document if you use WPF) and the user did not block clipboard access in IE zone settings
Dim doc As IHTMLDocument2 = DirectCast(webBrowser1.Document.DomDocument, IHTMLDocument2)
Dim body As IHTMLElement2 = DirectCast(doc.body, IHTMLElement2)
Dim imgRange As IHTMLControlRange = DirectCast(body.createControlRange(), IHTMLControlRange)
Dim image As IHTMLControlElement = DirectCast(DirectCast(doc, IHTMLDocument3).getElementById(sImgID), IHTMLControlElement)
imgRange.add(image)
imgRange.execCommand("Copy", False, Nothing)
Pseudo code:
For each element by tag 'img'. Get the 'src' attribute. Fire up an instance of HttpWebRequest or use WebClient.DownloadFile for the source.
You will need to do some trickery determining where the source is in relation to the url. For instance the src could be '/img/pony.jpg', in which case you'll need to get the url's root from the WebBrowser control to make it 'http://mylittle.com/img/pony.jpg'.
I have created a sample form as
Dim obj_CommonForm As New Form
Dim btn_Create As New Button
btn_Create.Location = New System.Drawing.Point(30, 200)
btn_Create.Size = New System.Drawing.Size(60, 15)
btn_Create.Text = "MyCommand"
obj_CommonForm.Controls.Add(btn_Create)
obj_CommonForm.Show()
Now I would like to save this form as .vb file and include it in my project.
Similar I have created in PHP where output html and saving as .php file is easy. This I have used as a initialize function as i start doing some project whose database has been created already.
Your question is not clear to me... so I try to guess.
If you want to have a .vb file then you just have to take the .vb created by Visual Studio or by your application and include it in the project at compile time.
Instead if you are talking about a generic form created by your program and load it at runtime, you have to learn something about Serialization.
In latter case, I had your same problem some time ago and following article was a good starting point:
http://community.visual-basic.it/lucianob/archive/2007/10/14/20711.aspx
It is in Italian, but I think you can translate via some tool (except for code examples, obviously) :-)