Click here to Skip to main content
15,921,530 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to pass textbox value from one form to other form in window application +c# Pin
Steve Echols21-Mar-08 19:06
Steve Echols21-Mar-08 19:06 
AnswerRe: how to pass textbox value from one form to other form in window application +c# Pin
ashok_rc521-Mar-08 19:16
ashok_rc521-Mar-08 19:16 
GeneralRe: how to pass textbox value from one form to other form in window application +c# Pin
Christian Graus21-Mar-08 19:40
protectorChristian Graus21-Mar-08 19:40 
AnswerRe: how to pass textbox value from one form to other form in window application +c# Pin
Christian Graus21-Mar-08 19:44
protectorChristian Graus21-Mar-08 19:44 
AnswerRe: how to pass textbox value from one form to other form in window application +c# Pin
Ravenet21-Mar-08 22:27
Ravenet21-Mar-08 22:27 
QuestionReading txt file to textbox Pin
Casper Hansen21-Mar-08 17:50
Casper Hansen21-Mar-08 17:50 
GeneralRe: Reading txt file to textbox Pin
Christian Graus21-Mar-08 19:41
protectorChristian Graus21-Mar-08 19:41 
GeneralRe: Reading txt file to textbox Pin
Casper Hansen22-Mar-08 14:17
Casper Hansen22-Mar-08 14:17 
I have been ripping my hair out because I cant find a solution.

I got it all working, but now I must format more text

I got a new text that has sections like this:

<br />
1<br />
0	33	10	85	162	95	168	-1	5	//Bull Fighter<br />
1	29	30	40	113	45	116	-1	3	//Hound<br />
2	41	5	126	160	125	161	-1	2	//Budge Dragon<br />
3	38	5	106	161	111	160	-1	2	//Spider<br />
4	38	5	106	161	111	160	-1	2	//Elite Bull Fighter<br />
6	38	5	106	161	111	160	-1	2	//Lich<br />
7	38	5	106	161	111	160	-1	2	//Giant<br />
14	38	5	106	161	111	160	-1	2	//Skeleton Warrior<br />
end<br />
0<br />
275	33	10	85	162	95	168	-1	5	//Test 1 Section 2<br />
275	29	30	40	113	45	116	-1	3	//Test 2 Section 2<br />
275	41	5	126	160	125	161	-1	2	//Test 3 Section 2<br />
275	38	5	106	161	111	160	-1	2	//Test 4 Section 2<br />
end


Now I changed my script so it reads the values from this script, and I changed the forward button so it jumps into new sections

But I just cant seem to figure out how to jump back to a section

This is the code that I use to go foward into a section:
if (pieces[0] == "end")<br />
{<br />
    curRec += 2;<br />
    displayLine(curRec);<br />
}<br />
else<br />
{


Here is all my code:
       // Displays the line in the arraylist<br />
        public void displayLine(int linenumber)<br />
        {<br />
            // If the line number is in the range of total values<br />
            if ((linenumber >= 0) && (linenumber < lines.Count))<br />
            {<br />
<br />
                // Get the string out of the arraylist<br />
                String line = (String)lines[linenumber];<br />
<br />
                // Split it into various pieces on the space<br />
                String[] pieces = line.Split('\t');<br />
<br />
                if (pieces[0] == "end")<br />
                {<br />
                    curRec += 2;<br />
                    displayLine(curRec);<br />
                }<br />
                else<br />
                {<br />
                    txtID.Text = pieces[0];<br />
                    txtMap.Text = pieces[1];<br />
                    txtMoving.Text = pieces[2];<br />
                    txtXStart.Text = pieces[3];<br />
                    txtYStart.Text = pieces[4];<br />
                    txtXEnd.Text = pieces[5];<br />
                    txtYEnd.Text = pieces[6];<br />
                    txtDirection.Text = pieces[7];<br />
                    txtCount.Text = pieces[8];<br />
                    txtComment.Text = pieces[9];<br />
                    mobImage.ImageLocation = "D:/images/" + pieces[0] + ".jpg";<br />
                }<br />
            }<br />
<br />
        }<br />
<br />
        // Arraylist to hold all lines of the file.<br />
        ArrayList lines = new ArrayList(100);<br />
<br />
        // Pointer variable to point to active record<br />
        int curRec = 0;<br />
<br />
        // Loading data and reading txt file<br />
        public void Form1_Load(object sender, EventArgs e)<br />
        {<br />
            // Open the data file<br />
            StreamReader f = new StreamReader(new FileStream(@"D:\monstersetbase.txt", FileMode.Open));<br />
<br />
            String curLine;<br />
<br />
            // Read in the data line by line and add it to our ArrayList<br />
            while ((curLine = f.ReadLine()) != null)<br />
            {<br />
                lines.Add(curLine);<br />
            }<br />
<br />
            // Close<br />
            f.Close();<br />
<br />
            // Add one so it will not crash<br />
            curRec += 1;<br />
<br />
            // Display first line<br />
            displayLine(curRec);<br />
        }<br />
<br />
        private void nxtButton_Click_1(object sender, EventArgs e)<br />
        {<br />
            if (curRec < lines.Count - 1)<br />
            {<br />
                curRec += 1;<br />
                displayLine(curRec);<br />
                prvButton.Enabled = true;<br />
            }<br />
        }<br />
<br />
        private void prvButton_Click_1(object sender, EventArgs e)<br />
        {<br />
            if (curRec == 2)<br />
            {<br />
                prvButton.Enabled = false;<br />
            }<br />
            if (curRec > 0)<br />
            {<br />
                curRec -= 1;<br />
                displayLine(curRec);<br />
            }<br />
        }

AnswerRe: Reading txt file to textbox Pin
Casper Hansen5-Apr-08 1:44
Casper Hansen5-Apr-08 1:44 
GeneralCommercial use of C# Express Pin
Ian Uy21-Mar-08 17:22
Ian Uy21-Mar-08 17:22 
GeneralRe: Commercial use of C# Express Pin
PIEBALDconsult21-Mar-08 17:45
mvePIEBALDconsult21-Mar-08 17:45 
GeneralRe: Commercial use of C# Express Pin
Ian Uy21-Mar-08 17:53
Ian Uy21-Mar-08 17:53 
GeneralRe: Commercial use of C# Express Pin
Christian Graus21-Mar-08 19:45
protectorChristian Graus21-Mar-08 19:45 
GeneralRe: Commercial use of C# Express Pin
Paul Conrad22-Mar-08 5:32
professionalPaul Conrad22-Mar-08 5:32 
QuestionApplication server for Forms based solution ( not Web Based ) . Pin
unitecsoft21-Mar-08 13:32
unitecsoft21-Mar-08 13:32 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
Christian Graus21-Mar-08 13:50
protectorChristian Graus21-Mar-08 13:50 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
unitecsoft21-Mar-08 14:27
unitecsoft21-Mar-08 14:27 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
MNFlyer21-Mar-08 15:19
MNFlyer21-Mar-08 15:19 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
Luis Alonso Ramos21-Mar-08 21:59
Luis Alonso Ramos21-Mar-08 21:59 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
MNFlyer22-Mar-08 4:06
MNFlyer22-Mar-08 4:06 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
Luis Alonso Ramos22-Mar-08 8:43
Luis Alonso Ramos22-Mar-08 8:43 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
MNFlyer22-Mar-08 4:09
MNFlyer22-Mar-08 4:09 
GeneralRe: Application server for Forms based solution ( not Web Based ) . Pin
Luis Alonso Ramos21-Mar-08 22:02
Luis Alonso Ramos21-Mar-08 22:02 
GeneralMDI Child to Mdi Parent controls z-order Pin
Stevo Z21-Mar-08 11:36
Stevo Z21-Mar-08 11:36 
GeneralRe: MDI Child to Mdi Parent controls z-order Pin
Luis Alonso Ramos21-Mar-08 22:06
Luis Alonso Ramos21-Mar-08 22:06 

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.