VB到C#.net转换器的问题 [英] problem in vb to C#.net convertor

查看:95
本文介绍了VB到C#.net转换器的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我有一段VB代码
当我将其转换为C#时,转换后的代码给出了错误.
有人可以帮我吗?

vb代码(此代码有效)

Hi all
I hava a piece vb code
When I convert it to C# the converted code gives a error.
Can anybody help me?

vb code (this code works)

Do Until vreadyState = 4
            Application.DoEvents()
            vreadyState = Me.WebBrowser1.ReadyState
        Loop
        Dim eleminput As HtmlElementCollection
        Dim DocCol As HtmlDocument
        DocCol = WebBrowser1.Document
        eleminput = DocCol.GetElementsByTagName("input")


C#代码


c# code

for (; (vreadystate == 4); )
            {
                Application.DoEvents();
                vreadystate = Convert.ToInt32(this.webBrowser1.ReadyState);

            }
            HtmlElementCollection eleminput = default(HtmlElementCollection);
            HtmlDocument DocCol = default(HtmlDocument);
            DocCol = webBrowser1.Document;
            eleminput =DocCol.GetElementsByTagName("input");



当我运行此代码时,我的程序在最后一行有错误
对象引用未设置为对象的实例."



When I run this code my program has a error in the last line
"Object reference not set to an instance of an object."

How to change this code to solve this error?

推荐答案

我使用了以下工具:http://www.developerfusion.com/tools/convert/vb-to-csharp/ [
I used this tool : http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]

while (!(vreadyState == 4)) {
    Application.DoEvents();
    vreadyState = this.WebBrowser1.ReadyState;
}

HtmlElementCollection eleminput = default(HtmlElementCollection);
HtmlDocument DocCol = default(HtmlDocument);
DocCol = WebBrowser1.Document;
eleminput = DocCol.GetElementsByTagName("input");





Is this working for you?


webBrowser1 ?? !!

将其设置为WebBrowser1.
或者,让我们知道您到底从哪里得到此错误.
webBrowser1??!

Make it WebBrowser1.
Or, let us know where exactly you get this error.


更改此
HtmlElementCollection eleminput = default(HtmlElementCollection);
HtmlDocument DocCol = default(HtmlDocument);




to

HtmlElementCollection eleminput;
HtmlDocument DocCol;


这篇关于VB到C#.net转换器的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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