我使用C#给Erros编写了用于从智能设备中的串行端口读取GPS数据的代码 [英] I write code for Reading GPS Data from Serial Port in smart device using C# giving Erros

查看:131
本文介绍了我使用C#给Erros编写了用于从智能设备中的串行端口读取GPS数据的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,
我使用C#编写了用于从智能设备中的串行端口读取GPS数据的代码,但遇到了一些错误(也在注释中//)

注释1 :此代码在Windows窗体中的C#中运行,但是在C#中的智能设备中尝试的相同代码也给出了错误.
注释2 :我的引用是:mscorlibSystemSystem.CoreSystem.DataSystem.Data.DataExtensionsSystem.DrawingSystem.Windows.FormsSystem.Web.ServiceSystem.XmlSystem.Xml.Linq
注释3 :我在该智能设备中使用Microsoft Visual Studio 2008(.net)->美国Windows Mobile 5.0 Packet PC R2仿真器

Hi friends,
I write code for Reading GPS Data from Serial Port in smart device using C# but getting some errors (also in the comment //)

Note 1: This code is working in Windows Forms in C# but the same code tried in Smart Device in C# is giving the errors.
Note 2: My references are: mscorlib, System, System.Core, System.Data, System.Data.DataExtensions, System.Drawing, System.Windows.Forms, System.Web.Service, System.Xml, System.Xml.Linq
Note 3: I am using Microsoft Visual Studio 2008 (.net) in that Smart Device-> usa windows mobile 5.0 Packet PC R2 Emulator

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.IO;
using System.Net;

namespace SerialGPS
{
    [System.Runtime.InteropServices.ComVisible(true)]
    public partial class Form1 : Form
    {
        SerialPort serialPort = new SerialPort();
        public delegate void myDelegate();
        private string outputFile;
        private string inputFile;
        private bool internetConnected = false;
        bool loadingFile = false;
        StreamWriter sw;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            string[] portNames = System.IO.Ports.SerialPort.GetPortNames();
            for (int i = 0; i < portNames.Length; i++)
            {
                portNumberBox.Items.Add(portNames[i]);
            }
            //load web browser control page
            if (HasInternetConnection())
            {
                string map = System.IO.File.ReadAllText(Application.StartupPath + "\\VEMap.html");
              //  Error	1	'System.IO.File' does not contain a definition for 'ReadAllText'
	         //   Error	2	'System.Windows.Forms.Application' does not contain a definition for 'StartupPath'      webBrowser1.DocumentText = map;
                webBrowser1.ObjectForScripting = this;
                //Error	3	'System.Windows.Forms.WebBrowser' does not contain a definition for 'ObjectForScripting' and no extension method 'ObjectForScripting' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	

                internetConnected = true;
            }
            timer1.Interval = 1500;
        }
        private void GPSConnectBtn_Click(object sender, EventArgs e)
        {
            if (GPSConnectBtn.Text == "Connect")
            {
                GPSConnectBtn.Text = "Disconnect";
                //close serial port if it is open
                if (serialPort.IsOpen)
                {
                    serialPort.Close();
                    timer1.Enabled = false;
                }
                try
                {
                    //configure the parameters of the serial port
                    serialPort.PortName = portNumberBox.Text;
                    serialPort.BaudRate = 9600;
                    serialPort.Parity = System.IO.Ports.Parity.None;
                    serialPort.DataBits = 8;
                    serialPort.StopBits = System.IO.Ports.StopBits.One;
                    serialPort.Open();
                    timer1.Enabled = true;
                    statusTxt.Text = "GPS on port " + portNumberBox.Text + " connected.";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                //close the serial port
                GPSConnectBtn.Text = "Connect";
                statusTxt.Text = "GPS on port " + portNumberBox.Text + " disconnected.";
                serialPort.Close();
                timer1.Enabled = false;
            }
        }
        public void UpdateGPSData()
        {
            try
            {
                if (serialPort.IsOpen)
                {
                    string data = serialPort.ReadExisting();
                    if (!String.IsNullOrEmpty(data))
                    {
                        GPSData.Text = data + "\r\n";
                        GPSData.ScrollToCaret();
                        ProcessNMEAData(data);
                        if (!String.IsNullOrEmpty(outputFile))
                        {
                            sw.WriteLine(data);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void UpdateMapData(string msg)
        {
           mapData.AppendText(msg + "\r\n");
            //Error	4	'System.Windows.Forms.TextBox' does not contain a definition for 'AppendText' and no extension method 'AppendText' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?)	
        }
        private void AddPushpin(double lat, double lon, string description)
        {
            object[] param = new object[] { lat, lon, description };
           webBrowser1.Document.InvokeScript("AddPushpin", param);
            //Error	5	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)

        }
        private void SaveGPS_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex = 2;
          //  saveFileDialog1.RestoreDirectory = true;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                outputFile = saveFileDialog1.FileName;
                sw = File.AppendText(outputFile);
            }
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            UpdateGPSData();
        }
        private bool HasInternetConnection()
        {
            HttpWebRequest req;
            HttpWebResponse resp;
            try
            {
                req = (HttpWebRequest)WebRequest.Create("http://googlemaps.com");
                resp = (HttpWebResponse)req.GetResponse();
                if (resp.StatusCode.ToString().Equals("OK"))
                {
                    //its connected.
                    return true;
                }
            }
            catch (Exception)
            {
                UpdateMapData("No internet connection");
            }
            return false;
        }
        private void ProcessNMEAData(string data)
        {
            string[] NMEALine = data.Split('$');
            string[] NMEAType;
            for (int i = 0; i < NMEALine.Length; i++)
            {
                NMEAType = NMEALine[i].Split(',');
                switch (NMEAType[0])
                {
                    case "GPGGA":
                        ProcessGPGGA(NMEAType);
                        break;
                    case "GPGLL":
                        break;
                    case "GPGSA":
                        break;
                    case "GPGSV":
                        break;
                    case "GPRMC":
                        break;
                    case "GPVTG":
                        break;
                    default:
                        break;
                }
            }
        }
        private void ProcessGPGGA(string[] data)
        {
            double lat, lon;
            double rawLatLong;
            rawLatLong = double.Parse(data[2].Replace(":00", ""));
            lat = ((int)(rawLatLong / 100)) + ((rawLatLong - (((int)(rawLatLong / 100)) * 100)) / 60);
            if (data[3] == "S")
                lat *= -1;
            rawLatLong = double.Parse(data[4].Replace(":00", ""));
            lon = ((int)(rawLatLong / 100)) + ((rawLatLong - (((int)(rawLatLong / 100)) * 100)) / 60);
            if (data[5] == "W")
                lon *= -1;
            currentLatitudeTbx.Text = lat.ToString();
            currentLongitudeTbx.Text = lon.ToString();
            if (internetConnected)
            {
                if (!loadingFile && FollowCbx.Checked)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<div>Latitude: {0}<br/>Longitude: {1}<br/>Altitude: {2} {3}</div>", lat, lon, data[9], data[10]);
                    AddPushpin(lat, lon, sb.ToString());
                }
                else if (loadingFile)
                {
                    object[] param = new object[] { lat, lon };
                   webBrowser1.Document.InvokeScript("AddPoint", param);
                    //Error	6	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
                }
            }
        }
        private void openFileBtn_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 2;
            //openFileDialog1.RestoreDirectory = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                inputFile = openFileDialog1.FileName;
                openFileTbx.Text = inputFile;
                LoadTrip();
               
           
            }            
        }
        private void LoadTrip()
        {
            if (!string.IsNullOrEmpty(inputFile))
            {
                StreamReader inputStream = new StreamReader(File.Open(inputFile, FileMode.Open));
                loadingFile = true;
                webBrowser1.Document.InvokeScript("ClearPoints");
  //    Error	7	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	

                string line = inputStream.ReadLine();
                while (!inputStream.EndOfStream)
                {
                    ProcessNMEAData(line);
                    line = inputStream.ReadLine();
                }
                webBrowser1.Document.InvokeScript("drawPath");
                //Error	8	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
                loadingFile = false;
                inputStream.Close();
            }
        }
        private void MapCurrentLocBtn_Click(object sender, EventArgs e)
        {
            double lat, lon;
           if (internetConnected && Double.TryParse(currentLatitudeTbx.Text, out lat)
               //Error	9	'double' does not contain a definition for 'TryParse'
               && Double.TryParse(currentLongitudeTbx.Text, out lon))
           //Error	10	'double' does not contain a definition for 'TryParse'	
            {
               object[] param = new object[] { lat, lon };
                webBrowser1.Document.InvokeScript("centerMap", param);
                //Error	11	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	

            }
        }
        private void drawPathBtn_Click(object sender, EventArgs e)
        {
            if (internetConnected)
            {
                webBrowser1.Document.InvokeScript("drawPath");
                //Error	12	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
            }
        }

        //Error	1	'System.IO.File' does not contain a definition for 'ReadAllText'
        //Error	2	'System.Windows.Forms.Application' does not contain a definition for 'StartupPath'      webBrowser1.DocumentText = map;
        //Error	3	'System.Windows.Forms.WebBrowser' does not contain a definition for 'ObjectForScripting' and no extension method 'ObjectForScripting' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
        //Error	4	'System.Windows.Forms.TextBox' does not contain a definition for 'AppendText' and no extension method 'AppendText' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?)	
        //Error	5	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)
        //Error	6	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
        //Error	7	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
        //Error	8	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
        //Error	9	'double' does not contain a definition for 'TryParse'
        //Error	10	'double' does not contain a definition for 'TryParse'	
        //Error	11	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	
        //Error	12	'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)	

    }
}

推荐答案

'); 字符串 [] NMEAType; for ( int i = 0 ; i < NMEALine.Length; i ++) { NMEAType = NMEALine [i] .Split(' ,'); 开关(NMEAType [ 0 ]) { 案例 " : ProcessGPGGA(NMEAType); break ; 案例 " : break ; 案例 " : break ; 案例 " : break ; 案例 " : break ; 案例 " : break ; 默认: break ; } } } 私有 无效 ProcessGPGGA(字符串 []数据) { double lat,lon; double rawLatLong; rawLatLong = double .Parse(data [ 2 ].Replace(" " )); lat =((( int )(rawLatLong/ 100 ))+((rawLatLong-(((( int )(rawLatLong/ 100 ))* 100 ))/ 60 ); 如果(数据[ 3 ] == " S") lat * = -1; rawLatLong = double .Parse(data [ 4 ].Replace(" " )); lon =((( int )(rawLatLong/ 100 ))+((rawLatLong-(((( int )(rawLatLong/ 100 ))* 100 ))/ 60 ); 如果(数据[ 5 ] == " W") lon * = -1; currentLatitudeTbx.Text = lat.ToString(); currentLongitudeTbx.Text = lon.ToString(); 如果(互联网已连接) { 如果(!loadingFile&& FollowCbx.Checked) { StringBuilder sb = StringBuilder(); sb.AppendFormat(" ,纬度,经度,数据[ 10 ]); AddPushpin(lat,lon,sb.ToString()); } 其他 如果(loadingFile) { 对象 [] param = 对象 [ ] {lat,lon}; webBrowser1.Document.InvokeScript(" ,param); // 错误6"System.Windows.Forms.WebBrowser"不包含文档"的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) } } } 私有 无效 openFileBtn_Click(对象发​​件人,EventArgs e) { openFileDialog1.Filter = " ; openFileDialog1.FilterIndex = 2 ; // openFileDialog1.RestoreDirectory = true; 如果(openFileDialog1.ShowDialog()== DialogResult.OK) { inputFile = openFileDialog1.FileName; openFileTbx.Text = inputFile; LoadTrip(); } } 私有 无效 LoadTrip() { 如果(!string.IsNullOrEmpty(inputFile)) { StreamReader inputStream = StreamReader(File.Open(inputFile,FileMode.Open)); loadingFile = true ; webBrowser1.Document.InvokeScript(" ); // 错误7'System.Windows.Forms.WebBrowser'不包含'Document'的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) 字符串 line = inputStream.ReadLine(); while (!inputStream.EndOfStream) { ProcessNMEAData(line); line = inputStream.ReadLine(); } webBrowser1.Document.InvokeScript(" ); // 错误8'System.Windows.Forms.WebBrowser'不包含'Document'的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) loadingFile = false ; inputStream.Close(); } } 私有 无效 MapCurrentLocBtn_Click(对象发​​件人,EventArgs e) { double lat,lon; 如果(互连的Internet Double .TryParse(currentLatitudeTbx.Text,// 错误9'double'不包含'TryParse'的定义 && .TryParse(currentLongitudeTbx.Text,输出 lon)) // 错误10'double'不包含'TryParse'的定义 { 对象 [] param = 对象 [ ] {lat,lon}; webBrowser1.Document.InvokeScript(" ,param); // 错误11"System.Windows.Forms.WebBrowser"不包含文档"的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) } } 私有 无效 drawPathBtn_Click(对象发​​件人,EventArgs e) { 如果(互联网已连接) { webBrowser1.Document.InvokeScript(" ); // 错误12'System.Windows.Forms.WebBrowser'不包含'Document'的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) } } // 错误1'System.IO.File'不包含'ReadAllText'的定义 // 错误2"System.Windows.Forms.Application"不包含"StartupPath" webBrowser1.DocumentText的定义=地图; // 错误3'System.Windows.Forms.WebBrowser'不包含'ObjectForScripting'的定义,也没有扩展方法会发现'ObjectForScripting'接受类型为'System.Windows.Forms.WebBrowser'的第一个参数(您是否缺少using指令或程序集引用?) // 错误4'System.Windows.Forms.TextBox'不包含'AppendText'的定义,也没有扩展方法会发现'AppendText'接受类型为'System.Windows.Forms.TextBox'的第一个参数(您是否缺少using指令或程序集引用?) // 错误5"System.Windows.Forms.WebBrowser"不包含文档"的定义,也没有扩展方法可以找到接受类型为"System.Windows.Forms.WebBrowser"类型的第一个参数的文档"(您是否缺少using指令或程序集引用?) // 错误6"System.Windows.Forms.WebBrowser"不包含文档"的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) // 错误7"System.Windows.Forms.WebBrowser"不包含文档"的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) // 错误8'System.Windows.Forms.WebBrowser'不包含'Document'的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) // 错误9'double'不包含'TryParse'的定义 // 错误10'double'不包含'TryParse'的定义 // 错误11"System.Windows.Forms.WebBrowser"不包含文档"的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) // 错误12'System.Windows.Forms.WebBrowser'不包含'Document'的定义,也没有扩展方法会发现文档"接受类型为"System.Windows.Forms.WebBrowser"的第一个参数(您是否缺少using指令或程序集引用?) } }
'); string[] NMEAType; for (int i = 0; i < NMEALine.Length; i++) { NMEAType = NMEALine[i].Split(','); switch (NMEAType[0]) { case "GPGGA": ProcessGPGGA(NMEAType); break; case "GPGLL": break; case "GPGSA": break; case "GPGSV": break; case "GPRMC": break; case "GPVTG": break; default: break; } } } private void ProcessGPGGA(string[] data) { double lat, lon; double rawLatLong; rawLatLong = double.Parse(data[2].Replace(":00", "")); lat = ((int)(rawLatLong / 100)) + ((rawLatLong - (((int)(rawLatLong / 100)) * 100)) / 60); if (data[3] == "S") lat *= -1; rawLatLong = double.Parse(data[4].Replace(":00", "")); lon = ((int)(rawLatLong / 100)) + ((rawLatLong - (((int)(rawLatLong / 100)) * 100)) / 60); if (data[5] == "W") lon *= -1; currentLatitudeTbx.Text = lat.ToString(); currentLongitudeTbx.Text = lon.ToString(); if (internetConnected) { if (!loadingFile && FollowCbx.Checked) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<div>Latitude: {0}<br/>Longitude: {1}<br/>Altitude: {2} {3}</div>", lat, lon, data[9], data[10]); AddPushpin(lat, lon, sb.ToString()); } else if (loadingFile) { object[] param = new object[] { lat, lon }; webBrowser1.Document.InvokeScript("AddPoint", param); //Error 6 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) } } } private void openFileBtn_Click(object sender, EventArgs e) { openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 2; //openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { inputFile = openFileDialog1.FileName; openFileTbx.Text = inputFile; LoadTrip(); } } private void LoadTrip() { if (!string.IsNullOrEmpty(inputFile)) { StreamReader inputStream = new StreamReader(File.Open(inputFile, FileMode.Open)); loadingFile = true; webBrowser1.Document.InvokeScript("ClearPoints"); // Error 7 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) string line = inputStream.ReadLine(); while (!inputStream.EndOfStream) { ProcessNMEAData(line); line = inputStream.ReadLine(); } webBrowser1.Document.InvokeScript("drawPath"); //Error 8 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) loadingFile = false; inputStream.Close(); } } private void MapCurrentLocBtn_Click(object sender, EventArgs e) { double lat, lon; if (internetConnected && Double.TryParse(currentLatitudeTbx.Text, out lat) //Error 9 'double' does not contain a definition for 'TryParse' && Double.TryParse(currentLongitudeTbx.Text, out lon)) //Error 10 'double' does not contain a definition for 'TryParse' { object[] param = new object[] { lat, lon }; webBrowser1.Document.InvokeScript("centerMap", param); //Error 11 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) } } private void drawPathBtn_Click(object sender, EventArgs e) { if (internetConnected) { webBrowser1.Document.InvokeScript("drawPath"); //Error 12 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) } } //Error 1 'System.IO.File' does not contain a definition for 'ReadAllText' //Error 2 'System.Windows.Forms.Application' does not contain a definition for 'StartupPath' webBrowser1.DocumentText = map; //Error 3 'System.Windows.Forms.WebBrowser' does not contain a definition for 'ObjectForScripting' and no extension method 'ObjectForScripting' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) //Error 4 'System.Windows.Forms.TextBox' does not contain a definition for 'AppendText' and no extension method 'AppendText' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?) //Error 5 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) //Error 6 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) //Error 7 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) //Error 8 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) //Error 9 'double' does not contain a definition for 'TryParse' //Error 10 'double' does not contain a definition for 'TryParse' //Error 11 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) //Error 12 'System.Windows.Forms.WebBrowser' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?) } }


Well, we all know that double has a TryParse() method, and I checked the MSDN site, and the WebBrowser object has a Document property (all the way back to .Net 2.0), so it looks like you''re missing one or more references. Make sure you have all the necessary references added to your project, and that you''re doing a clean/rebuild on the entire solution before moving it to your smart device..
Well, we all know that double has a TryParse() method, and I checked the MSDN site, and the WebBrowser object has a Document property (all the way back to .Net 2.0), so it looks like you''re missing one or more references. Make sure you have all the necessary references added to your project, and that you''re doing a clean/rebuild on the entire solution before moving it to your smart device..


"This code is working in Windows Forms in C# but the same code tried in Smart Device in C# is giving the errors."

OK, well, that tells you my answer is correct, surely ?

Not having double.TryParse seems a bit insane, but I don''t see any other possible answer.
"This code is working in Windows Forms in C# but the same code tried in Smart Device in C# is giving the errors."

OK, well, that tells you my answer is correct, surely ?

Not having double.TryParse seems a bit insane, but I don''t see any other possible answer.


这篇关于我使用C#给Erros编写了用于从智能设备中的串行端口读取GPS数据的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆