i bought a book on C# by Head First .. and there is SO MUCH bugs, i have 15 errors. I have checked the errata as well for this but this is not listed.
i created a class called Talker as the book shown and have went through te code with a bone comb, here it is:
namespace WindowsFormsApplication1
{
class Talker
{
public static int BlaBlaBla(string thingToSay, int numberOfTimes);
string finalString = "";
for (int count =1; count <= numberoftimes; count++)
{
finalstring = finalstring + thingtosay + "\n";
}
MessageBox.Show(finalstring);
return finalstring.Length;
}
}
i have lots of them saying "invalid token in class"
thanks
Loading
FroglegPosted Dec 15, 2010, 2:29 PM
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i = Talker.BlaBlaBla("whatever", 5);
}
}
class Talker
{
public static int BlaBlaBla(string thingToSay, int numberOfTimes)
{
string finalString = "";
for (int count =1; count <= numberOfTimes; count++)
{
finalString = finalString + thingToSay + "\n";
}
MessageBox.Show(finalString);
return finalString.Length;
}
This is how i got it to work.
John BurnsPosted Dec 16, 2010, 5:44 AM
feels frustrating when the problem happens, but feels even better when you solvwe it :)
John BurnsPosted Dec 16, 2010, 5:44 AM
feels frustrating when the problem happens, but feels even better when you solvwe it :)
Suthish NairPosted Dec 16, 2010, 5:39 AM
Nice to hear, you got through the error. This is how we learn programming, from mistakes only.
Keep posting the queries.
Also, remember to mark the post as accepted answer, this will help others in future.
John BurnsPosted Dec 15, 2010, 3:10 PM
this casued 15 errors and missery ... thanks lol :)
John BurnsPosted Dec 15, 2010, 2:09 PM
if i cant sort this then there is no point studying c# with a book thats as useful as a sponge umbrella!
John BurnsPosted Dec 15, 2010, 1:27 PM