|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
UI to enter values into a structureDim 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 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 Show quoteHide quote > 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 > Thanks for your help. This seems like a good idea for a GotDotNet
project! -Jim GhostInAK wrote: Show quoteHide quote > 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 > > > > 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 > >
what's available in WMI
VB.NET Screen Stops Refreshing After Losing Focus?? Why choose SQL Express over Access? Offset lines appearing over form after delay (NVIDIA Chipset) "select case" statement optimization in VB and C# problems Soap Formatter namespace not found Restart, but after a delay Update database field WTSEnumerateProcesses My object/class/whatever |
|||||||||||||||||||||||