G
Guest
Hi peter,
Sorry I missed the new keyword in the post.
Actually the "new" keyword is there in my code.Here is my code.
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using SampleMap1.mapref;
using System.Net;
using System.Diagnostics;
using System.Web.Services;
namespace SampleMap1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.MainMenu mainMenu1;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(24, 16);
this.pictureBox1.Size = new System.Drawing.Size(168, 216);
//
// button1
//
this.button1.Location = new System.Drawing.Point(40, 256);
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.ClientSize = new System.Drawing.Size(266, 296);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Menu = this.mainMenu1;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
string MPUID = "XXXXX";
string MPPW = "XXXXXX";
FindServiceSoap findService = new FindServiceSoap();
FindSpecification findSpec = new FindSpecification();
findService.Credentials = new NetworkCredential(MPUID, MPPW);
findService.PreAuthenticate =true;
findSpec.DataSourceName = "MapPoint.NA";
findSpec.InputPlace = "Seattle, WA";
FindResults foundResults = findService.Find(findSpec);
ViewByHeightWidth[] myViews = new ViewByHeightWidth[1];
myViews[0] = foundResults.Results[0].FoundLocation.BestMapView.ByHeightWidth;
RenderServiceSoap renderService = new RenderServiceSoap();
renderService.Credentials = new NetworkCredential(MPUID, MPPW);
MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Views = myViews;
MapImage[] mapImages = renderService.GetMap(mapSpec);
System.IO.Stream streamImage;
streamImage = new System.IO.MemoryStream(mapImages[0].MimeData.Bits);
Bitmap bitmapImage = new Bitmap(streamImage);
pictureBox1.Image = bitmapImage;
}
}
}
Thanks
latha.
Sorry I missed the new keyword in the post.
Actually the "new" keyword is there in my code.Here is my code.
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using SampleMap1.mapref;
using System.Net;
using System.Diagnostics;
using System.Web.Services;
namespace SampleMap1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.MainMenu mainMenu1;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(24, 16);
this.pictureBox1.Size = new System.Drawing.Size(168, 216);
//
// button1
//
this.button1.Location = new System.Drawing.Point(40, 256);
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.ClientSize = new System.Drawing.Size(266, 296);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Menu = this.mainMenu1;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
string MPUID = "XXXXX";
string MPPW = "XXXXXX";
FindServiceSoap findService = new FindServiceSoap();
FindSpecification findSpec = new FindSpecification();
findService.Credentials = new NetworkCredential(MPUID, MPPW);
findService.PreAuthenticate =true;
findSpec.DataSourceName = "MapPoint.NA";
findSpec.InputPlace = "Seattle, WA";
FindResults foundResults = findService.Find(findSpec);
ViewByHeightWidth[] myViews = new ViewByHeightWidth[1];
myViews[0] = foundResults.Results[0].FoundLocation.BestMapView.ByHeightWidth;
RenderServiceSoap renderService = new RenderServiceSoap();
renderService.Credentials = new NetworkCredential(MPUID, MPPW);
MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Views = myViews;
MapImage[] mapImages = renderService.GetMap(mapSpec);
System.IO.Stream streamImage;
streamImage = new System.IO.MemoryStream(mapImages[0].MimeData.Bits);
Bitmap bitmapImage = new Bitmap(streamImage);
pictureBox1.Image = bitmapImage;
}
}
}
Thanks
latha.