You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Pages: 1
Topic closed
Hello Jing,
I am trying to extract data from a Memory Workbook in VB NET. I can load it without problem with the next sentece.
Public Workbook = ReoGridControl.CreateMemoryWorkbook
However, when I try to refer to one sheet:
sheet = WorkbookModel.Worksheets("Sheet01")
give an error of type: 'System.MissingMemberException' "public member Worksheets can't be found"
Could you tell me what I am doing wrong?
Thank you.
Offline
Hi, what is the type of WorkbookModel, maybe you should use:
sheet = Workbook.Worksheets("Sheet01")
And, are you sure the sheet name is 'Sheet01' rather than 'Sheet1' ?
Offline
Sorry, the correct code is as follow. The name for my workbook is WorkbookModel
Public WorkbookModel = ReoGridControl.CreateMemoryWorkbook
sheet = WorkbookModel.Worksheets("Sheet01")
The problem is that WorksSheets doesn't appear as a member of the Workbook when I write "WorkbookModel. "
Offline
There should be an environment problem. Please try remove the DLL reference and add it again for your project. Also please tell me the version of ReoGrid you are using. Below is an example which I've tested now in VB.NET:
Dim worksheet = ReoGridControl.CreateMemoryWorkbook
Dim sheet = worksheet.Worksheets("Sheet1")
sheet("A1") = 123
Offline
I am using the version 0.9.3. The previous code work well when all is in the same subrrutine. The problem is when the object worksheet is a global variable like the following:
Module Test
Public workbook = ReoGridControl.CreateMemoryWorkbook
Public Sub LoadExcel()
Dim sheet As Worksheet
Dim path As String
path = "C:\Users\Ant\Documents\ModelEst.xlsx"
workbook.Load(path, IO.FileFormat.Excel2007)
sheet = workbook.Worksheets("Sheet1") 'this sentence gives me an error
End Sub
end module
Offline
You must explicitly specify the type of class member variable since .NET compiler can't determine the type automatically for a class member. Try this:
Public workbook As IWorkbook = ReoGridControl.CreateMemoryWorkbook
And make sure you have imported the namespace at top:
Imports unvell.ReoGrid
Offline
Thank you very much. Now it works perfectly.
Offline
Pages: 1
Topic closed