473,738 Members | 11,192 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding PREVIOUS and CURRENT data to VB form via single XML file

I'm using VB.NET and I have an application that binds a schema to the main
form's controls, and the user has the ability to load an XML file through
the schema and into the bound form. [CODE POSTED AT END OF MESSAGE]

My problem is this: the schema contains an element called "TRENDED" and it
has an attribute called "type" whose value can be "previous" or "current".
This element can occur twice in the XML, once with the attribute-value
"previous" and a second time with the attribute-value "current". When the
user loads the XML into the form, the form needs to display both the
"previous" and "current" data. How do I "conditiona l-ize" the bindings so
that the form knows when to display a "current" value and when to display a
"previous" value?

NOTE: All of the data-binding has been done in the GUI.

[CODE SNIPPETS]

[XML]
<TRENDED type="previous" >
<HEIGHT>
<FEET>6</FEET>
<INCHES>2</INCHES>
</HEIGHT>
</TRENDED>
<TRENDED type="current">
<HEIGHT>
<FEET>6</FEET>
<INCHES>4</INCHES>
</HEIGHT>
</TRENDED>

[XSD]
<xs:element name="TRENDED" maxOccurs="2" minOccurs="1">
<xs:complexType >
<xs:sequence>
<xs:element name="HEIGHT" minOccurs="0" maxOccurs="unbo unded">
<xs:complexType >
<xs:sequence>
<xs:element name="FEET" type="xs:string " minOccurs="0"
/>
<xs:element name="INCHES" type="xs:string " minOccurs="0"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:sequence>
<xs:attribute name="type" form="unqualifi ed" type="trendType "
use="required" />
</xs:complexType>
</xs:element>
<xs:simpleTyp e name="trendType ">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="previous " />
<xs:enumerati on value="current" />
</xs:restriction>
</xs:simpleType>
Thanks in advance for any help.
Andy
Nov 11 '05 #1
1 2039
I've figured it out.

I have to programmaticall y bind the items that will contain "previous" and
"current" data.


"Andy Wells" <aw****@aegisgr oup.com> wrote in message
news:O7******** ******@tk2msftn gp13.phx.gbl...
I'm using VB.NET and I have an application that binds a schema to the main
form's controls, and the user has the ability to load an XML file through
the schema and into the bound form. [CODE POSTED AT END OF MESSAGE]

My problem is this: the schema contains an element called "TRENDED" and it has an attribute called "type" whose value can be "previous" or "current".
This element can occur twice in the XML, once with the attribute-value
"previous" and a second time with the attribute-value "current". When the
user loads the XML into the form, the form needs to display both the
"previous" and "current" data. How do I "conditiona l-ize" the bindings so
that the form knows when to display a "current" value and when to display a "previous" value?

NOTE: All of the data-binding has been done in the GUI.

[CODE SNIPPETS]

[XML]
<TRENDED type="previous" >
<HEIGHT>
<FEET>6</FEET>
<INCHES>2</INCHES>
</HEIGHT>
</TRENDED>
<TRENDED type="current">
<HEIGHT>
<FEET>6</FEET>
<INCHES>4</INCHES>
</HEIGHT>
</TRENDED>

[XSD]
<xs:element name="TRENDED" maxOccurs="2" minOccurs="1">
<xs:complexType >
<xs:sequence>
<xs:element name="HEIGHT" minOccurs="0" maxOccurs="unbo unded">
<xs:complexType >
<xs:sequence>
<xs:element name="FEET" type="xs:string " minOccurs="0"
/>
<xs:element name="INCHES" type="xs:string " minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:sequence>
<xs:attribute name="type" form="unqualifi ed" type="trendType "
use="required" />
</xs:complexType>
</xs:element>
<xs:simpleTyp e name="trendType ">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="previous " />
<xs:enumerati on value="current" />
</xs:restriction>
</xs:simpleType>
Thanks in advance for any help.
Andy

Nov 11 '05 #2

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

Similar topics

3
1477
by: Jow Blow | last post by:
Hello All, In two different books, Simple Data Binding to a control is explained with an example of a TextBox where the data is initialized with an array. For example a class is defined as such: public class Vendor {
1
4058
by: Terencetrent | last post by:
I have created a query that examines qarterly sales for 5 regions in the country. The query contains data for the past 6 quarters for each region and calculates the perecentage of total sales for the quarter fo each region. To help enhance the report I would love to include a comparison to of current sales to previous quarter sales and a comparison of current sales to sales a year ago. I am having a devil of a time creating a query to...
0
1271
by: Empire City | last post by:
I have a screen: Email address: ------------ Name: -------------- Phone: ---------------- Add, Change, Delete, Cancel, Exit When the user enters the email address and hits TAB in the EmailTextBox_Leave method, I create and fill a DataSet with the single
11
4660
by: Rourke Eleven | last post by:
I have looked and searched. What good is the databind property on Radiobuttons? How does one go about actually using it? What is a good resource on this? I understand that I can easily get/set the information I need programmatically, but what about the databind property I just don't understand it's value.
19
2343
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this object to databind to text boxes etc? I can't use a dataset as the object has loads of derived logic, for example updating one property may actually update several database fields for example.
0
4804
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having manually inserted a row in the table bound to the Combo box. The InsertAt Method of adding a row just does not work. Hope this helps anyone with this problem. john
2
1869
by: Bob | last post by:
I have noticed that as one adds related tables to a bindingsource and dataset(vs2005 Vb.Net Sql Server 2005), the TODO and following code that fills the datasets on form load are written to the formload event in the order in which you drag the tables to the form to make a gridview, the last table you drag is written to the top. Since you normallly start by dragging the parent table and then the child tables and grandchild tables, what...
2
1773
by: Viraptor | last post by:
Hello I've created a form with 2 listboxes. Both have data-binding. First one is "normal", 1:1 view of table. Second is filled using parameter from the first one. this.xxxTableAdapter.Fill(this.mainDataSet.XXX, (int)this.BindingContext.Current); When I do it in Form_Load() it shows first listbox with element with "id" of value 2 selected, but this.BindingContext.Current == 1. When I do the same thing in
1
2466
by: SteveT | last post by:
Folks, I am reading/writing data within an XML file. In my form I have a label that is assigned to the UpdateDate field within the XML file. Within the form I update the label to a different date. The code is below. The issue I'm having is that the DataBinding doesn't seem to be behaving correctly. The changed value of my "label" is not being written to the file when AcceptChanges() is called. Instead, the original value from within...
0
9476
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.