Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
AnswerRe: Current Directory Pin
Hessam Jalali8-Aug-07 6:34
Hessam Jalali8-Aug-07 6:34 
AnswerRe: Current Directory Pin
Judah Gabriel Himango8-Aug-07 6:38
sponsorJudah Gabriel Himango8-Aug-07 6:38 
QuestionText Box in listview Pin
topksharma19828-Aug-07 5:41
topksharma19828-Aug-07 5:41 
AnswerRe: Text Box in listview Pin
Hessam Jalali8-Aug-07 5:57
Hessam Jalali8-Aug-07 5:57 
GeneralRe: Text Box in listview Pin
topksharma19828-Aug-07 20:28
topksharma19828-Aug-07 20:28 
QuestionEvents to use for DataGrid to monitor Progress bar updates Pin
Boyd Lowry8-Aug-07 5:25
Boyd Lowry8-Aug-07 5:25 
QuestionPrint on CDs Pin
Richard Blythe8-Aug-07 4:59
Richard Blythe8-Aug-07 4:59 
QuestionCurious Bug Pin
JamesBarnes8-Aug-07 4:56
JamesBarnes8-Aug-07 4:56 
The code below reads data from a binary file into an instance, then writes that instance to an instance array (forgive me if my terminology is wrong, I'm self taught ^^)

The first time it runs through the loop it works fine, but as it goes through the second iteration it begins to over write the data in ItemsArray[0], even though the counter c is now 1 AND i haven't even told it to write to the array.

It is as if it were writing the data to the array before being told to :s

I hope I've made the problem clear, if not, just ask for clarification Smile | :)

Am i making an obvious error?

Thanks ^^

Items[] ItemsArray = new Items[NumberOfRecords];<br />
            Items Item = new Items();<br />
<br />
            int c = 0;<br />
<br />
            while (c < NumberOfRecords)<br />
            {<br />
                bw.Seek((c * 180), SeekOrigin.Begin);<br />
                Item.SetName(br.ReadString()); //on second iteration, this overwrites whats in ItemsArray[0]<br />
                bw.Seek((c * 180) + 40, SeekOrigin.Begin);<br />
                Item.SetItemType(br.ReadString());<br />
                bw.Seek((c * 180) + 60, SeekOrigin.Begin);<br />
                Item.SetDescription(br.ReadString());<br />
                bw.Seek((c * 180) + 160, SeekOrigin.Begin);<br />
                Item.SetWeight(br.ReadInt32());<br />
                Item.SetWeaponDamage(br.ReadInt32());<br />
                Item.SetWeaponRange(br.ReadInt32());<br />
                Item.SetWeaponMultiShot(br.ReadInt32());<br />
                Item.SetArmourRate(br.ReadInt32());<br />
<br />
                ItemsArray[c] = Item; //Supposed to write item to the item array slot.<br />
<br />
                <br />
                c++;<br />
<br />
            }

AnswerRe: Curious Bug Pin
Hessam Jalali8-Aug-07 5:15
Hessam Jalali8-Aug-07 5:15 
AnswerRe: Curious Bug Pin
Colin Angus Mackay8-Aug-07 5:17
Colin Angus Mackay8-Aug-07 5:17 
AnswerRe: Curious Bug Pin
m@u8-Aug-07 5:17
m@u8-Aug-07 5:17 
AnswerRe: Curious Bug Pin
User 66588-Aug-07 5:18
User 66588-Aug-07 5:18 
GeneralRe: Curious Bug Pin
JamesBarnes8-Aug-07 5:29
JamesBarnes8-Aug-07 5:29 
GeneralRe: Curious Bug Pin
JamesBarnes8-Aug-07 5:37
JamesBarnes8-Aug-07 5:37 
QuestionGetting a computer name from the IP address(C#) Pin
WvdW8-Aug-07 4:23
WvdW8-Aug-07 4:23 
AnswerRe: Getting a computer name from the IP address(C#) Pin
led mike8-Aug-07 4:46
led mike8-Aug-07 4:46 
AnswerRe: Getting a computer name from the IP address(C#) Pin
Hessam Jalali8-Aug-07 5:06
Hessam Jalali8-Aug-07 5:06 
GeneralRe: Getting a computer name from the IP address(C#) Pin
WvdW8-Aug-07 5:38
WvdW8-Aug-07 5:38 
GeneralRe: Getting a computer name from the IP address(C#) Pin
Hessam Jalali8-Aug-07 5:45
Hessam Jalali8-Aug-07 5:45 
GeneralRe: Getting a computer name from the IP address(C#) Pin
WvdW8-Aug-07 6:24
WvdW8-Aug-07 6:24 
QuestionAccessing Windows Form through a Thread of another Thread Pin
ictoane8-Aug-07 3:51
ictoane8-Aug-07 3:51 
AnswerRe: Accessing Windows Form through a Thread of another Thread Pin
Luc Pattyn8-Aug-07 4:13
sitebuilderLuc Pattyn8-Aug-07 4:13 
GeneralRe: Accessing Windows Form through a Thread of another Thread Pin
ictoane8-Aug-07 4:56
ictoane8-Aug-07 4:56 
AnswerRe: Accessing Windows Form through a Thread of another Thread Pin
pbraun8-Aug-07 4:42
pbraun8-Aug-07 4:42 
GeneralRe: Accessing Windows Form through a Thread of another Thread Pin
ictoane8-Aug-07 5:08
ictoane8-Aug-07 5:08 

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.