Multiline Textbox with XML and Dataset

tonycrew

Well-known member
Joined
Apr 20, 2009
Messages
55
Programming Experience
Beginner
Ok, as in my other post i asked this!!

VB.NET:
            If TextBox7.Text.Contains(ComboBox1.Text) Then
                If ComboBox1.Text = "" Then

                Else
                    TextBox7.Text = TextBox7.Text.Replace(ComboBox1.Text, TextBox1.Text)
                End If
            End If
            If TextBox7.Text.Contains(ComboBox2.Text) Then
                If ComboBox2.Text = "" Then

                Else
                    TextBox7.Text = TextBox7.Text.Replace(ComboBox2.Text, TextBox2.Text)
                End If
            End If
            If TextBox7.Text.Contains(ComboBox7.Text) Then
                If ComboBox7.Text = "" Then

                Else
                    TextBox7.Text = TextBox7.Text.Replace(ComboBox7.Text, TextBox10.Text)
                End If
            End If
            If TextBox7.Text.Contains(ComboBox3.Text) Then
                If ComboBox3.Text = "" Then

                Else
                    TextBox7.Text = TextBox7.Text.Replace(ComboBox3.Text, TextBox8.Text)
                End If
            End If
            If TextBox7.Text.Contains(ComboBox4.Text) Then
                If ComboBox4.Text = "" Then

                Else
                    TextBox7.Text = TextBox7.Text.Replace(ComboBox4.Text, TextBox3.Text)
                End If
            End If
            If TextBox7.Text.Contains(ComboBox5.Text) Then
                If ComboBox5.Text = "" Then

                Else
                    TextBox7.Text = TextBox7.Text.Replace(ComboBox5.Text, TextBox4.Text)
                End If
            End If

and the reason of
VB.NET:
If Combobox1.Text = "" Then
is because when its blank and you click the update, if the field your updating is blank from start, it wont update it will come up with an error!!

why? please help me..
 
What it is, is a XML.

<menu>
<game name="3 Ninjas Kick Back (USA)">
<description>3 Ninjas Kick Back</description>
<crc>e5a24999</crc>
<manufacturer>Malibu</manufacturer>
<year>1994</year>
<genre>Action/Platformer</genre>
</game>
<game name="6-Pak (USA)">
<description>6-Pak</description>
<crc>1a6f45dc</crc>
<manufacturer>Sega</manufacturer>
<year>1996</year>
<genre>Miscellaneous/Compilation</genre>
</game>
<game name="688 Attack Sub (USA, Europe)">
<description>688 Attack Sub</description>
<crc>f2c58bf7</crc>
<manufacturer>Sega</manufacturer>
<year>1991</year>
<genre>Simulation/Submarine</genre>
</game>
<game name="AAAHH!!! Real Monsters (USA, Europe)">
<description>AAAHH!!! Real Monsters</description>
<crc>fdc80bfc</crc>
<manufacturer>Realtime Associates</manufacturer>
<year>1995</year>
<genre>Action/Platformer</genre>
</game>
<game name="Action 52 (USA) (Unl)">
<description>Action 52</description>
<crc>29ff58ae</crc>
<manufacturer>Farsight Technologies</manufacturer>
<year>1993</year>
<genre>Miscellaneous/Compilation</genre>
</game>
<game name="Addams Family Values (Europe) (En,Fr,De)">
<description>Addams Family Values</description>
<crc>b906b992</crc>
<manufacturer></manufacturer>
<year>1994</year>
<genre>Role-Playing/General</genre>
</game>

When wanting to update any info if there is a blank feild then it won't add new info into it. So in the last one you see manufacturer has no data, we can't add this info.

So with this code
If Combobox1.Text = "" Then
We are telling it that if it is blank then do nothing, if we dont have that in then when we try to add new info into a blank field we get an integar error.
 
Why don't you use the Xml tools of .Net, System.Xml namespace for example has the XmlDocument class and related classes that make it convenient to handle Xml data.
In some cases it also makes sense to load the Xml into a Dataset and handle it at that level.
Depends on what you are doing with the data.
 
we have it a datatset, and you can edit the field which arnt blank and update them but not blank ones, its the same with trying to just erase one of them out of the dataset (they all called "game" as the table)
 
Back
Top