Click here to Skip to main content
15,902,938 members
Home / Discussions / C#
   

C#

 
AnswerRe: Property problem in the VS Designer Pin
Luc Pattyn27-Jun-07 14:45
sitebuilderLuc Pattyn27-Jun-07 14:45 
QuestionXML in C# Pin
Kris10027-Jun-07 13:12
Kris10027-Jun-07 13:12 
AnswerRe: XML in C# Pin
max2929727-Jun-07 13:34
max2929727-Jun-07 13:34 
AnswerRe: XML in C# Pin
Amit Kumar G27-Jun-07 13:49
Amit Kumar G27-Jun-07 13:49 
AnswerRe: XML in C# Pin
Christian Graus27-Jun-07 14:01
protectorChristian Graus27-Jun-07 14:01 
GeneralRe: XML in C# Pin
Mark Greenwood27-Jun-07 14:58
Mark Greenwood27-Jun-07 14:58 
AnswerRe: XML in C# Pin
Kris10028-Jun-07 2:39
Kris10028-Jun-07 2:39 
GeneralRe: XML in C# Pin
max2929728-Jun-07 11:55
max2929728-Jun-07 11:55 
Okay, now that I am learned in the art of XML in C# Wink | ;) , here's some code:

using System;<br />
using System.IO;<br />
using System.Xml;<br />
using System.Collections;<br />
<br />
class Run {<br />
   static void Main() {<br />
      XmlTextReader reader = new XmlTextReader("file.xml");<br />
      <br />
      ArrayList titles = new ArrayList();<br />
      ArrayList descriptions = new ArrayList();<br />
      ArrayList images = new ArrayList();<br />
      <br />
      reader.MoveToContent();<br />
      while (reader.Read()) {<br />
         if (reader.NodeType == XmlNodeType.Element) {<br />
            switch (reader.Name) {<br />
               case "Title":<br />
                  titles.Add(reader.ReadString());<br />
                  break;<br />
               case "Description":<br />
                  descriptions.Add(reader.ReadString());<br />
                  break;<br />
               case "Image":<br />
                  images.Add(reader.ReadString());<br />
                  break;<br />
            }<br />
         }<br />
      }<br />
      <br />
      for (int a = 0; a < titles.Count; a++) {<br />
         Console.WriteLine("-----" + titles[a] + "-----");<br />
         Console.WriteLine(descriptions[a]);<br />
         Console.WriteLine("Image: " + images[a]);<br />
         Console.WriteLine();<br />
      }<br />
   }<br />
}


There 'ya go! This code gathers all the data and seperates it into ArrayLists, then writes them to the console. To do what you are speaking of, all you have to do is...

  1. Create your two textboxes, an imagebox (I think that's what it's called) and two buttons
  2. Create an index integer (e.g. int index = 0;)
  3. For the Click event of the next button, increase the index field by one and set the properties of the textboxes and imagebox to the data in the ArrayLists. (e.g. titleBox.Text = titles[index]; descriptionBox.Text = descriptions[index]; etc.)
  4. For the Click event of the back button, do the same thing, except decrease the index field
  5. Don't forget - if index is greater than titles.Count, set index to zero, and if index < 0, set index to titles.Count


That should do it.

-----
*** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***

GeneralRe: XML in C# Pin
max2929728-Jun-07 12:22
max2929728-Jun-07 12:22 
QuestionApplication Properties? Pin
max2929727-Jun-07 12:51
max2929727-Jun-07 12:51 
AnswerRe: Application Properties? Pin
J$27-Jun-07 13:27
J$27-Jun-07 13:27 
GeneralRe: Application Properties? Pin
max2929727-Jun-07 13:31
max2929727-Jun-07 13:31 
GeneralRe: Application Properties? Pin
Luc Pattyn27-Jun-07 14:28
sitebuilderLuc Pattyn27-Jun-07 14:28 
AnswerRe: Application Properties? Pin
Luc Pattyn27-Jun-07 14:37
sitebuilderLuc Pattyn27-Jun-07 14:37 
QuestionInfo about sound from microphone Pin
Joseph133727-Jun-07 12:13
Joseph133727-Jun-07 12:13 
AnswerRe: Info about sound from microphone Pin
Christian Graus27-Jun-07 14:03
protectorChristian Graus27-Jun-07 14:03 
AnswerRe: Info about sound from microphone Pin
Luc Pattyn27-Jun-07 14:53
sitebuilderLuc Pattyn27-Jun-07 14:53 
AnswerRe: Info about sound from microphone Pin
Leslie Sanford27-Jun-07 16:39
Leslie Sanford27-Jun-07 16:39 
QuestionOWC Excel Problem Pin
TheMajorRager27-Jun-07 11:38
TheMajorRager27-Jun-07 11:38 
AnswerRe: OWC Excel Problem Pin
Dave Kreskowiak27-Jun-07 12:01
mveDave Kreskowiak27-Jun-07 12:01 
QuestionCan I change the Opacity of control units in a form? Pin
Khoramdin27-Jun-07 10:35
Khoramdin27-Jun-07 10:35 
AnswerRe: Can I change the Opacity of control units in a form? Pin
Ed.Poore27-Jun-07 10:43
Ed.Poore27-Jun-07 10:43 
AnswerRe: Can I change the Opacity of control units in a form? Pin
Dave Kreskowiak27-Jun-07 11:57
mveDave Kreskowiak27-Jun-07 11:57 
QuestionImage Processing: Redraw the outline of any image (sketching) in C#.Net, but How?? Pin
zeeShan anSari27-Jun-07 9:44
zeeShan anSari27-Jun-07 9:44 
AnswerRe: Image Processing: Redraw the outline of any image (sketching) in C#.Net, but How?? Pin
Luc Pattyn27-Jun-07 10:16
sitebuilderLuc Pattyn27-Jun-07 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.