I have an array of a template type which I am scanning within a function to find a particular row. I would like to return that row (or all values from the row) from the function but haven’t been able to determine how to declare a variable of that type.
The template is called teststbl, as shown below:
Can I Dim a variable of that type in VB .NET?
Any advice appreciated.
If you want to access a row from a user defined type, you can use the following method:
Dim dt As DataTable=TK.ProjectDB.GetUserTemplate(“teststbl”);
The TK.ProjectDB.GetUserTemplate() method will retrieve a DataTable that contains all the rows and columns from the Template you created. If you wish to display this table, you can assign it to a DataTable type variable and set it as the data source for a DataGrid object.
Regarding declaring a variable of a user defined type, it isnot possible. However, you can create a local class that matches the structure of your template. Then, you can assign each member of your tag to the corresponding variable.
Here’s an example where a class called “Templates” is created, and a variable test1 of type Templates is declared:
Please let us know if this information is helpful to you.
Thanks for your explanation. It helped direct me to a good solution for my problem.