如何将VB6中的OLE1替换为VB.NET [英] How to replace OLE1 in VB6 to VB.NET

查看:153
本文介绍了如何将VB6中的OLE1替换为VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将代码从VB6转换为VB.NET2010,遇到了需要您帮助的问题
我在VB6中有如下代码:

 打开 ls_FileName 对于 二进制  #li_FileNum
Me.OLE1( 1 ).ReadFromFile li_FileNum 



并显示错误:"ReadFromFile不是System.Windows.Forms.Label的成员"
而且我无法解决,因为我不知道OLE1和ReadFromFile的情况以及在VB.NET中用什么来替换它.

如果您知道的话,请帮助我.

在此先谢谢您.

解决方案

我们不知道OLE1是什么,因此很难为您提供解决方案.标签控件显然对文件不执行任何操作.

您发布的代码表明OLE1是窗体上的标签控件,并且它是控件数组的一部分.

除此之外,您将不得不在原始VB6 source(!)中研究表单上的控件及其背后的代码,以弄清楚此控件应该和应该执行的操作.

如果要读取文件,请使用File.ReadAllText或类似文件. System.IO.File具有用于从文件读取信息的静态方法.我们不知道要怎么做才能得到这个特定的错误,但是您必须定义一个名为OLE1的标签数组.


我认为在VB.NET中OLE1是标签数组但是在VB6中,也许是用于读取文件的类,我不确定.
对您来说,以上哪些代码将在VB.NET中重播?


I am converting code from VB6 to VB.NET2010 and I met a problem that need your help
I have code in VB6 as below:

Open ls_FileName For Binary As #li_FileNum
Me.OLE1(1).ReadFromFile li_FileNum



and it displayed error: "ReadFromFile is not a member of System.Windows.Forms.Label"
and I can''t fixed because i don''t know how OLE1 and ReadFromFile are and What using to replace it in VB.NET .

Please help me if you know.

Thanks in advance.

解决方案

We have no idea what OLE1 is so it''s difficult to give you a solution. Label controls don''t do anything with files, obviously.

The code you posted suggests that OLE1 is a label control on the form and that it is part of a control array.

Other than that, you''re going to have to study the controls on the form and the code behind them in the original VB6 source(!) to figure out what this control is supposed to be and supposed to be doing.


If you want to read from a file, then use File.ReadAllText or similar. System.IO.File has static methods for reading information from files. We have no idea what you''ve done to get this specific error, but you must have defined an array called OLE1, of labels.


I think in VB.NET OLE1 is label array but in VB6 maybe it is class that is used to read file,I am not sure that.
For you, What above code will be replayed to in VB.NET?


这篇关于如何将VB6中的OLE1替换为VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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