473,320 Members | 1,612 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,320 software developers and data experts.

able to and/or how to programmatically loop through web forms VB.N

Hi,

I'm not sure if we are able to or even how to loop through the web forms in
a VB.NET project during design time. In MSAccess we are able to go through
the database -> forms collection and loop through all the forms in a database
and pull information about the form (controls and properties). We would need
to do the same in our VB.NET project; loop through the project and get the
web form's control and property information programmatically. The information
needs to get populated into a table in the database.

If anyone has any ideas that would be most helpful.

Thanks,
Jul 21 '05 #1
6 2794
Tim
Are you upsizing your Access app to a web app?

"ALthePal" wrote:
Hi,

I'm not sure if we are able to or even how to loop through the web forms in
a VB.NET project during design time. In MSAccess we are able to go through
the database -> forms collection and loop through all the forms in a database
and pull information about the form (controls and properties). We would need
to do the same in our VB.NET project; loop through the project and get the
web form's control and property information programmatically. The information
needs to get populated into a table in the database.

If anyone has any ideas that would be most helpful.

Thanks,

Jul 21 '05 #2
Hi Tim,

Sort of ... we have a product that is in an Access database and we have
upsized most of the forms and code to VB.NET (ADO.NET, Oracle/SQL server). We
have a feature in the Access version that allows users to validate data on
various forms in the system through a wizard. In order for users to be able
to easily create their own data validation on data input forms, we have a
wizard that allows them to view the "chosen" form, view the data fields and
create the validation for the fields. We need all our form information in a
table to allow this feature (in our product).

What I am trying to do is to programmatically extract the form information
and save them to the table without having to add additional lines of code to
every form.

I hope this information helps.
Thanks,
Alice
"Tim" wrote:
Are you upsizing your Access app to a web app?

"ALthePal" wrote:
Hi,

I'm not sure if we are able to or even how to loop through the web forms in
a VB.NET project during design time. In MSAccess we are able to go through
the database -> forms collection and loop through all the forms in a database
and pull information about the form (controls and properties). We would need
to do the same in our VB.NET project; loop through the project and get the
web form's control and property information programmatically. The information
needs to get populated into a table in the database.

If anyone has any ideas that would be most helpful.

Thanks,

Jul 21 '05 #3
Tim
Alice,

I think I am almost there in understanding what you are try to do in your
app. Just have few more questions.

Are you already able to save the validation rules after the user defines them?

If so, are you trying to implement code that applies the rules created by
the users to each form as they are activated without having to put the code
in each form?

Do you use menu items to access each of the forms?
"ALthePal" wrote:
Hi Tim,

Sort of ... we have a product that is in an Access database and we have
upsized most of the forms and code to VB.NET (ADO.NET, Oracle/SQL server). We
have a feature in the Access version that allows users to validate data on
various forms in the system through a wizard. In order for users to be able
to easily create their own data validation on data input forms, we have a
wizard that allows them to view the "chosen" form, view the data fields and
create the validation for the fields. We need all our form information in a
table to allow this feature (in our product).

What I am trying to do is to programmatically extract the form information
and save them to the table without having to add additional lines of code to
every form.

I hope this information helps.
Thanks,
Alice
"Tim" wrote:
Are you upsizing your Access app to a web app?

"ALthePal" wrote:
Hi,

I'm not sure if we are able to or even how to loop through the web forms in
a VB.NET project during design time. In MSAccess we are able to go through
the database -> forms collection and loop through all the forms in a database
and pull information about the form (controls and properties). We would need
to do the same in our VB.NET project; loop through the project and get the
web form's control and property information programmatically. The information
needs to get populated into a table in the database.

If anyone has any ideas that would be most helpful.

Thanks,

Jul 21 '05 #4
Hi Al,

I see more-or-less what you're trying to do. Unfortunately, I don't
think that you can duplicate the Access behavior in a Web Project, mainly
because there is no out-of-the-box "container" ( like .. Access ) that
contains a list of forms.

The only similar entity I can think of for a web project would be the
actual virtual directory or web site in IIS. you can get programmatic access
to IIS through WMI using .NET ( I think ), but you can also do that using
scripting, check out the IIS Admin scripts under webroot on your IIS
installation. However, at best I think you'd only be able to get a list of
"files" or "forms" under the site root & sub-folders, without having the
distinction between data entry forms & other sorts of pages there ...

If I could recommend another approach ? If you've already invested time in
ASP.NET web Forms code it will seem a lot of hussle, but ... it's the only
thing I can think of off the top of my head:

You could generate the data entry forms dynamically. For instance, we have
defined data entry forms in xml here, and use that to generate an HTML
interface through XSL. Then, as the form is posted, all forms go to the same
..aspx ( or HttpHandler ), which uses the form xml to instantiate the
required validators with the needed parameters, validate the form data, and
do whatever if validation is successful, or return the user to the form
indicating the errors.

Our form description looks something like this:

<?xml version="1.0" encoding="utf-8" ?>
<forms>
<form id="Register" xsl-file="form.xsl" handler-class="">
<fields>
<field id="uname" type="TextField">
<validators>
<validator
class="System.Web.UI.WebControls.RequiredFieldVali dator">
<properties>
<property name="InitialValue" value=""/>
<property name="ErrorMessage" value="Please fill-in the
required field: Password"/>
</properties>
</validator>
</validators>
</field>
</fields>
</form>
</forms>

... i know, it's kinda bloated, but let's leave that aside for a minute -
we're working on that :D

If you use this xml-based approach, you could work on the forms, fields &
validators, because you have all the forms defined in the xml, which is
something you can work with in a much simpler way. It wouldn't be hard to
create some sort of UI for Form creation & editing.

It all boils down in the impementation of the engine, the two aspx pages
that will be used for displaying the form, and processing the input.
Something like this:

http://localhost/dynforms/DisplayFor...?form=Register

&

http://localhost/dynforms/ProcessFor...uname=whatever (
assuming that you're using GET, but using POST doesn't really change
anything in the implementation. I do it so that I can see that it actually
passes the parameters correctly,and I'll switch to POST afterwards ... )

The displaying part is easy. All you need to do is create some simple XSL to
generate an HTML form from the xml, and just write that out directly to your
Response output stream.

the processing part is a bit trickier - mainly because ASP.NET validators
are actually UI components as far as ASP.NET is concerned, so you'll have to
write some trivial code to add them onto the page, despite the fact that
nothing will be displayed ... :? .. it's one of those things with ASP.NET I
guess ...

...but in the end of all this, you'll have an excellent(?) way of producing
data entry forms, at the same time being able to edit them, add/remove
fields, validators and end-point behavior (save to DB ? e-mail the form
contents ? both ? whatever else ? ) completely dynamically.

It's worked wonders for me so far, being able to add validating forms to a
site with a single xml description ( I should point out though that you only
get server-side validation this way, otherwise you'll really have to do some
XSL wonders to generate & add the client-side validation Javascript .. )

If you do decide to follow this approach however, bear in mind that you'd
better create aome class hierarchy & parse the xml inot objects if you've
got too many forms on your project. Keeping an xml file of 200K in memory is
a bit of an overhead for your server. The same xml in object form is much
smaller in memory size.

Well, that's what I think :] hope this helped a bit cos' it took me 10' to
write :D

Angel
O:]

"ALthePal" <AL******@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
Hi Tim,

Sort of ... we have a product that is in an Access database and we have
upsized most of the forms and code to VB.NET (ADO.NET, Oracle/SQL server). We have a feature in the Access version that allows users to validate data on
various forms in the system through a wizard. In order for users to be able to easily create their own data validation on data input forms, we have a
wizard that allows them to view the "chosen" form, view the data fields and create the validation for the fields. We need all our form information in a table to allow this feature (in our product).

What I am trying to do is to programmatically extract the form information
and save them to the table without having to add additional lines of code to every form.

I hope this information helps.
Thanks,
Alice
"Tim" wrote:
Are you upsizing your Access app to a web app?

"ALthePal" wrote:
Hi,

I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and loop through all the forms in a database and pull information about the form (controls and properties). We would need to do the same in our VB.NET project; loop through the project and get the web form's control and property information programmatically. The information needs to get populated into a table in the database.

If anyone has any ideas that would be most helpful.

Thanks,

Jul 21 '05 #5
Hi Tim,

sorry for the late reply ... but yes we are saving the validation rules
after the user defines them. When they open the form again we check the
validation rule, and run the expected outcome for the rule (hide fields,
messages to user etc.).

Yes, we are trying to run the validation as the web form is called without
having to put code behind each form ... way to many forms.

I'm not sure what you mean by menu items to access the forms ... the main
form is embedded in a frameset and in a frame beside the main form resides
the navigation tree. We are basically trying to recreate the desktop version
in a web format ... getting to be tricky.

Thanks in advance for your help,
Alice

"Tim" wrote:
Alice,

I think I am almost there in understanding what you are try to do in your
app. Just have few more questions.

Are you already able to save the validation rules after the user defines them?

If so, are you trying to implement code that applies the rules created by
the users to each form as they are activated without having to put the code
in each form?

Do you use menu items to access each of the forms?
"ALthePal" wrote:
Hi Tim,

Sort of ... we have a product that is in an Access database and we have
upsized most of the forms and code to VB.NET (ADO.NET, Oracle/SQL server). We
have a feature in the Access version that allows users to validate data on
various forms in the system through a wizard. In order for users to be able
to easily create their own data validation on data input forms, we have a
wizard that allows them to view the "chosen" form, view the data fields and
create the validation for the fields. We need all our form information in a
table to allow this feature (in our product).

What I am trying to do is to programmatically extract the form information
and save them to the table without having to add additional lines of code to
every form.

I hope this information helps.
Thanks,
Alice
"Tim" wrote:
Are you upsizing your Access app to a web app?

"ALthePal" wrote:

> Hi,
>
> I'm not sure if we are able to or even how to loop through the web forms in
> a VB.NET project during design time. In MSAccess we are able to go through
> the database -> forms collection and loop through all the forms in a database
> and pull information about the form (controls and properties). We would need
> to do the same in our VB.NET project; loop through the project and get the
> web form's control and property information programmatically. The information
> needs to get populated into a table in the database.
>
> If anyone has any ideas that would be most helpful.
>
> Thanks,

Jul 21 '05 #6
Hi Angel,

Thanks for you help.

I like the idea of dynamically creating the forms but because we are trying
to duplicate the look and feel of an existing desktop version ... it'll be
hard to do with all the style sheets and such.

I don't have as much experience with ASP as you do so most of what you have
written has just gone over my head ... sorry. Plus all the time you spent in
responding to me ... thanks. I really appreciate it ... I"ll have to pass
this on to my co-workers that will be able to dumb down the information here
for me ;)

Thanks so much for your help and time,
Alice

"Angelos Karantzalis" wrote:
Hi Al,

I see more-or-less what you're trying to do. Unfortunately, I don't
think that you can duplicate the Access behavior in a Web Project, mainly
because there is no out-of-the-box "container" ( like .. Access ) that
contains a list of forms.

The only similar entity I can think of for a web project would be the
actual virtual directory or web site in IIS. you can get programmatic access
to IIS through WMI using .NET ( I think ), but you can also do that using
scripting, check out the IIS Admin scripts under webroot on your IIS
installation. However, at best I think you'd only be able to get a list of
"files" or "forms" under the site root & sub-folders, without having the
distinction between data entry forms & other sorts of pages there ...

If I could recommend another approach ? If you've already invested time in
ASP.NET web Forms code it will seem a lot of hussle, but ... it's the only
thing I can think of off the top of my head:

You could generate the data entry forms dynamically. For instance, we have
defined data entry forms in xml here, and use that to generate an HTML
interface through XSL. Then, as the form is posted, all forms go to the same
..aspx ( or HttpHandler ), which uses the form xml to instantiate the
required validators with the needed parameters, validate the form data, and
do whatever if validation is successful, or return the user to the form
indicating the errors.

Our form description looks something like this:

<?xml version="1.0" encoding="utf-8" ?>
<forms>
<form id="Register" xsl-file="form.xsl" handler-class="">
<fields>
<field id="uname" type="TextField">
<validators>
<validator
class="System.Web.UI.WebControls.RequiredFieldVali dator">
<properties>
<property name="InitialValue" value=""/>
<property name="ErrorMessage" value="Please fill-in the
required field: Password"/>
</properties>
</validator>
</validators>
</field>
</fields>
</form>
</forms>

... i know, it's kinda bloated, but let's leave that aside for a minute -
we're working on that :D

If you use this xml-based approach, you could work on the forms, fields &
validators, because you have all the forms defined in the xml, which is
something you can work with in a much simpler way. It wouldn't be hard to
create some sort of UI for Form creation & editing.

It all boils down in the impementation of the engine, the two aspx pages
that will be used for displaying the form, and processing the input.
Something like this:

http://localhost/dynforms/DisplayFor...?form=Register

&

http://localhost/dynforms/ProcessFor...uname=whatever (
assuming that you're using GET, but using POST doesn't really change
anything in the implementation. I do it so that I can see that it actually
passes the parameters correctly,and I'll switch to POST afterwards ... )

The displaying part is easy. All you need to do is create some simple XSL to
generate an HTML form from the xml, and just write that out directly to your
Response output stream.

the processing part is a bit trickier - mainly because ASP.NET validators
are actually UI components as far as ASP.NET is concerned, so you'll have to
write some trivial code to add them onto the page, despite the fact that
nothing will be displayed ... :? .. it's one of those things with ASP.NET I
guess ...

...but in the end of all this, you'll have an excellent(?) way of producing
data entry forms, at the same time being able to edit them, add/remove
fields, validators and end-point behavior (save to DB ? e-mail the form
contents ? both ? whatever else ? ) completely dynamically.

It's worked wonders for me so far, being able to add validating forms to a
site with a single xml description ( I should point out though that you only
get server-side validation this way, otherwise you'll really have to do some
XSL wonders to generate & add the client-side validation Javascript .. )

If you do decide to follow this approach however, bear in mind that you'd
better create aome class hierarchy & parse the xml inot objects if you've
got too many forms on your project. Keeping an xml file of 200K in memory is
a bit of an overhead for your server. The same xml in object form is much
smaller in memory size.

Well, that's what I think :] hope this helped a bit cos' it took me 10' to
write :D

Angel
O:]

"ALthePal" <AL******@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
Hi Tim,

Sort of ... we have a product that is in an Access database and we have
upsized most of the forms and code to VB.NET (ADO.NET, Oracle/SQL server).

We
have a feature in the Access version that allows users to validate data on
various forms in the system through a wizard. In order for users to be

able
to easily create their own data validation on data input forms, we have a
wizard that allows them to view the "chosen" form, view the data fields

and
create the validation for the fields. We need all our form information in

a
table to allow this feature (in our product).

What I am trying to do is to programmatically extract the form information
and save them to the table without having to add additional lines of code

to
every form.

I hope this information helps.
Thanks,
Alice
"Tim" wrote:
Are you upsizing your Access app to a web app?

"ALthePal" wrote:

> Hi,
>
> I'm not sure if we are able to or even how to loop through the web forms in > a VB.NET project during design time. In MSAccess we are able to go through > the database -> forms collection and loop through all the forms in a database > and pull information about the form (controls and properties). We would need > to do the same in our VB.NET project; loop through the project and get the > web form's control and property information programmatically. The information > needs to get populated into a table in the database.
>
> If anyone has any ideas that would be most helpful.
>
> Thanks,


Jul 21 '05 #7

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

Similar topics

4
by: J1C | last post by:
If I only know the value of an option is a select list, is it possible to programmatically select that option? I would be returning the value from a server-side script ...
8
by: deko | last post by:
I'm trying to find a way to set form/control properties programmatically. In a nut shell: 1. Open a database 2. Open a form in design view 3. Do something like this: For Each prp In...
2
by: Charles | last post by:
Ok, so I'm creating a form on the fly. I can create the option group, I can create the checkboxes, but I can't figure out how to bind them to the option group I'm creating them within. I was...
4
by: | last post by:
I have a "form field highlight" javascript that I've added to some of my ASP.NET forms using the following syntax: body.Attributes.Add("onClick", "highlight(event);");...
3
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change...
6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
3
by: Ken Fine | last post by:
I'm interested in programmatically manipulating groups of ASP.NET controls by type. Can someone suggest code for the following? Loop through, say, all label controls on a page, and assigning a...
0
by: =?Utf-8?B?Qm9iQWNoZ2lsbA==?= | last post by:
I want to programmatically add a Flash control to my form that already has some Flash controls. (so I know the references are right) I tried the following code but it does not work. Do you see...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.