Click here to Skip to main content
15,071,729 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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:
SQL
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.
Posted

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.
   
Comments
ngthtra 12-Jul-11 0:38am
   
I know but in this case, logic command is wrong becacuse It can not run the statement ReadFromFile. do you know there are which command to replace it in VN.NET? I want it run in VB.NET and
Can you tell me in VB6,what OLE control is used? because my project use many this control(OLE1(i))
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?
   
Comments
Christian Graus 11-Jul-11 21:43pm
   
Please don't push 'answer' to ask questions. OLE1 is NOTHING in VB.NET. However, in this case, it appears that you've created an array of labels, and you're therefore accessing a label. There's no other explanation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900