473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UI to enter values into a structure

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

Jun 1 '06 #1
2 1024
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

Jun 2 '06 #2
Thanks for your help. This seems like a good idea for a GotDotNet
project!

-Jim
GhostInAK wrote:
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


Jun 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RBohannon | last post by:
I have a report with most fields populated by a query. However, some of the fields are variable in such a way that their values cannot be queried from a table. At present the values for these...
7
by: cFleury | last post by:
I have an ASP.NET web form that is retaining values over different stations on the network, how can I stop this behavior ?. I didn’t do anything special to cause it. Thanks C.Fleury
12
by: Dennis D. | last post by:
Hello: I want a function to return three variables to the calling procedure: Private Function CalcTimes(ByVal iAddDays as Integer, ByVal iAddHours as Integer, ByVal iAddMins as Integer) As...
7
by: Brett | last post by:
I need an object/structure such as an array but each item within the array is a complex structure. For example, I have 5 items, say: A thru E. The number of items may change. Each item has...
4
by: Tamer via DotNetMonster.com | last post by:
I'm developing a graphic engine. I got all equations made, I need only to understand how I can create a function that, once accepted three values (x; y; z), it returns the two values (X; Y) coming...
5
by: fkater | last post by:
Hi, we need to enter lots of data which are basicly descriptions of pc hardware configuration like this: Mainboard: vendor=... #of PCI slots=3 slot 1 graphic adapter
3
by: ishwarbg | last post by:
Hi Everyone, I have a .Net Application, through which I am invoking a function from a legacy DLL developed in C++. My structure in C# contains some data of type double which I need to pass to to...
3
by: haelly | last post by:
Write a program that prompts the user to enter three different integer values.If the values are not different, the program prints a message"equal values" and terminates(hint: use the return...
2
ADezii
by: ADezii | last post by:
The incentive for this Tip was an Article by the amazing Allen Browne - I considered it noteworthy enough to post as The Tip of the Week in this Access Forum. Original Article by Allen Browne ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.