Click here to Skip to main content
15,918,889 members
Home / Discussions / C#
   

C#

 
QuestionShowing button for property value selction in property pan Pin
KrunalC27-Jun-07 17:44
KrunalC27-Jun-07 17:44 
AnswerRe: Showing button for property value selction in property pan Pin
KrunalC27-Jun-07 21:03
KrunalC27-Jun-07 21:03 
Questionhelp debug the ping program please Pin
neodeaths27-Jun-07 17:20
neodeaths27-Jun-07 17:20 
AnswerRe: help debug the ping program please Pin
Luc Pattyn27-Jun-07 23:07
sitebuilderLuc Pattyn27-Jun-07 23:07 
QuestionUsing Mousewheel----help needed? Pin
Raza568027-Jun-07 17:19
Raza568027-Jun-07 17:19 
AnswerRe: Using Mousewheel----help needed? Pin
RepliCrux27-Jun-07 17:30
RepliCrux27-Jun-07 17:30 
AnswerRe: Using Mousewheel----help needed? Pin
Luc Pattyn27-Jun-07 22:32
sitebuilderLuc Pattyn27-Jun-07 22:32 
Questionneed help with telnet with c# console application Pin
neodeaths27-Jun-07 17:17
neodeaths27-Jun-07 17:17 
QuestionSELECT("c-ip" = '12.12.12.12') Pin
Glen Harvy27-Jun-07 14:40
Glen Harvy27-Jun-07 14:40 
AnswerRe: SELECT("c-ip" = '12.12.12.12') Pin
Christian Graus27-Jun-07 14:47
protectorChristian Graus27-Jun-07 14:47 
GeneralRe: SELECT("c-ip" = '12.12.12.12') Pin
Glen Harvy27-Jun-07 15:30
Glen Harvy27-Jun-07 15:30 
GeneralRe: SELECT("c-ip" = '12.12.12.12') Pin
Christian Graus27-Jun-07 19:38
protectorChristian Graus27-Jun-07 19:38 
AnswerRe: SELECT("c-ip" = '12.12.12.12') Pin
Glen Harvy27-Jun-07 17:47
Glen Harvy27-Jun-07 17:47 
QuestionProperty problem in the VS Designer Pin
ploe27-Jun-07 13:55
ploe27-Jun-07 13:55 
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 

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.