UI to enter values into a structure

J

jim_adams

For a nested structure such as:

Dim userVariable as one

structure one
dim a as string
dim b() as two
end structure

structure two
dim c as string
dim d as string
end structure

before I do the monkey work of creating a VB.Net UI for an end user to
fill out values for userVariable, I was wondering if there's a generic
code sample that will take in a structure and provide a dynamic form to
fill out its properties. Although the nested structure I'm working
with is more complex than this example, all data types are either
strings or integers.

Any insight is greatly appreciated.

Thanks,

Jim
 
G

GhostInAK

Hullo Jimbo,
Your best bet is going to lie with the Reflection classes.

Check out the System.Type class... something along the lines of:

Public Structure Foo
Private sSomeString As String

Public Property SomeString As String
Get
Return sSomeString
End Get
Set (byval tValue as String)
sSomeString = tValue
End Set
End Property
End Structure


Public Sub MakeForm()
Dim tInfo as PropertyInfo = Nothing

For Each tInfo in GetType(Foo)
' Do some crap.. make the form field.. etc.
Next

end Sub
 
J

jim_adams

Thanks for your help. This seems like a good idea for a GotDotNet
project!

-Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top