128 Posted Topics

Member Avatar for james6754

I just got a first on my first assignment in C# programming... I would just like to say a massive thank you for everyone that has helped me out on here up to now and know that I really appreciate it. This site has helped me massively with problems and …

Member Avatar for ~s.o.s~
3
97
Member Avatar for james6754

[CODE] TextReader myreader = new StreamReader; [/CODE] Is this inheritance...?? Thanks

Member Avatar for kvprajapati
0
80
Member Avatar for james6754

Lets say i have this [CODE] Console.WriteLine "Enter your number or type exit and press enter to exit program"; string input = Console.ReadLine(); if (input == "exit") { break; } [/CODE] so my question is if you enter "exit" how do i get the console to exit? break just breaks …

Member Avatar for kvprajapati
0
87
Member Avatar for darkseid

Hmmm..if you mean like swapping the values of your letter array to your number array and vice versa... put the values in to a new array..then swap them from that...i dont think there is a method in c# that actually does this...Maybe someone can clarify? (I would be interested to …

Member Avatar for darkseid
0
149
Member Avatar for prvnkmr194

you should take a look at the try catch finally statement. [url]http://msdn.microsoft.com/en-us/library/dszsf989(v=vs.71).aspx[/url] Without posting your code it is difficult to apply exception handling to it!

Member Avatar for prvnkmr194
0
184
Member Avatar for riiseuk

Hi mate can you give some more info about exactly what your trying to achieve.. you have uneeded parts of code such as [CODE] string NumberAsString = System.Console.ReadLine(); int mark = Convert.ToInt32(NumberAsString); [/CODE] NumberAsString is in string format anyway so you can do these two lines in a single line... …

Member Avatar for riiseuk
0
127
Member Avatar for CHOCHOCHO

OK...yeh thats not a bad assignment... You need to make a start yourself though... What code have you got so far?

Member Avatar for Singlem
0
651
Member Avatar for james6754

Hi..... [CODE] private void button1_Click(object sender, EventArgs e) { Decimal[] mydecimal = new Decimal[10]; for (int i = 0; i < mydecimal.Length; i++) { mydecimal[i] += i; } foreach (Decimal mydec in mydecimal) { int count = 0; MessageBox.Show("I am button "+ Convert.ToInt32(count)+" in mydecimal"); count += count + 1; …

Member Avatar for james6754
0
128
Member Avatar for james6754

If I have [CODE] class Class1 { string message { get; set; } int age { get; set; } public Class1(string msg, int ageof) { message = msg; age = ageof; } [/CODE] and am passing the parameters from another class in to the constructor... [CODE] class Program { static …

Member Avatar for ddanbe
0
103
Member Avatar for james6754

Hi everyone... [CODE] Class1 myobject = new Class1(); [/CODE] Am I right in saying that "myobject" holds a copy of all the members in class1? Also say for instance I have.. [CODE] Class1 myobject = new Program(); //using the common names of classes... [/CODE] Can anyone explain or point me …

Member Avatar for Mitja Bonca
0
80
Member Avatar for johnt68

[CODE] Form newForm = new winnerForm();//show if NAUGHTS wins - pass winner and score newForm.Show(); //call above then output a messagebox from winnerForm [/CODE] any good?

Member Avatar for johnt68
0
109
Member Avatar for james6754

Hi everyone..... [CODE] class Program { private int price = 0; static void Main(string[] args) { Program instance = new Program(); Console.WriteLine("ENTER PRICE"); instance.price = Convert.ToInt32(Console.ReadLine()); } [/CODE] Ok so im learning...as you may have guessed... My question is..I know we should use getters and setters so we can shield …

Member Avatar for Mitja Bonca
0
75
Member Avatar for raja289
Member Avatar for soneal777

Hmmm..just a simple problem here i think...say for instance num2 is returned as 5... The path to your .jpg file is say "\front5.jpg"... I believe if you put another two backslashes where i put the stars..you should be good to go...let me know.. [CODE] int num2 = randomNum(1,6); dice2PictureBox.Image = …

Member Avatar for soneal777
0
430
Member Avatar for james6754

Hi, as I understand it, you can only access a static member from another static member? can anyone tell me how I would go about accessing a static member in a different class?? thanks.. also if anyone has any good links to sites about constructors..would be most grateful :-)

Member Avatar for james6754
0
82
Member Avatar for james6754

Hi everyone...just going from console apps to windows forms apps....This is extremely basic and is annoying me now... [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("{0}",hello2(2)); } public int hello2(int hello) { hello = 10 / 5; …

Member Avatar for Farhad.idrees
0
149
Member Avatar for james6754

Hi all...could anyone please tell me how when working with arrays you could use a forach loop to output the number of a certain item... for instance...if i wanted to find out the number of 5's in an array...could i use a foreach loop to find that out? Thanks

Member Avatar for Venjense
0
120
Member Avatar for Peter1

Hi mate...the easiest way would be to make an array with your values... then declare another variable that will then hold the max number out of the numbers in your array. for example.... [CODE] //initilize your array of numbers... int[] myArray = {23, 58, 20, 19, 38, 12}; //now make …

Member Avatar for iconoclazt
0
196
Member Avatar for Peter1

Do some more reading around object oriented programming....(OOP)

Member Avatar for james6754
0
127
Member Avatar for james6754

Hi everyone...I am at University and learning C# for my software development modules. Presently I am mostly using "Beginning Microsoft Visual C# 2008" (although I find C# for dummies pretty good!). Its always the case that some books suit people better than others and they find them easier to understand. …

Member Avatar for vedro-compota
2
163
Member Avatar for cthoes

Hi mate...code seems to be fine...just put a curly brace to close the namespace and you should be good to go....

Member Avatar for james6754
0
3K
Member Avatar for nvidia123
Member Avatar for Joe544
0
85
Member Avatar for MasterGberry

.SubString will return the rest of the string from the element you specify onwards... Example: [CODE] string yourstring = "HELLO"; Console.WriteLine(yourstring.SubString(2)) [/CODE] in this case the output on the console would be LLO... Hope that makes sense?

Member Avatar for MasterGberry
0
143
Member Avatar for james6754

If I have a variable in a try catch block the variable is only in scope within that try block...how can I then refer to this variable from the next try catch block?

Member Avatar for everhett.raman
0
205
Member Avatar for james6754

Hi everyone.... [code] public void LoopGrades() { try//Start try block { //Start TextReader TextReader grades = new StreamReader("grades.dat"); ResultOfData = grades.ReadLine(); } catch (FileNotFoundException e) { MessageBox.Show("File Not Found!", "Error"); } //Loop through grades while (ResultOfData != null) { //ResultOfData is given the value that is read from grades.dat ResultOfData …

Member Avatar for james6754
0
130
Member Avatar for james6754

Hi there...im after a bit of adivce..I am doing an assignment that requires reading grades from a file...seeing how many grades there are of each and for higher marks outputting them to a html file in the form of a graph(instead of a graph to the console screen)... Could anyone …

0
35
Member Avatar for james6754

Hi there just a quick question I am using C#Express. When I add the reference System.Windows.Forms I cannot seem to access Messagebox.Show...any ideas what I am doing wrong? Btw this is in a console application...

Member Avatar for Mitja Bonca
0
157
Member Avatar for james6754

[code] class ReadGradesIn { public void readGrade() { int numberOfA = 0; //number of A grades int numberOfB = 0;//number of B grades int numberOfC = 0;//number of C grades int numberOfD = 0;//number of D grades int numberOfE = 0;//number of E grades int numberOfF = 0;//number of F …

Member Avatar for jbrock31
0
203

The End.