128 Posted Topics

Member Avatar for justlearnin

[CODE] string address = "123 w elm"; //so here u would just change to address = / //textbox1.Text string[] myArray = address.Split(' '); foreach (var item in myArray) { label1.Text = myArray[0]; label2.Text = myArray[1]; label3.Text = myArray[2]; } [/CODE] Something like the above

Member Avatar for justlearnin
0
126
Member Avatar for Saima_Khan
Member Avatar for james6754

[CODE] USHORT * pInt = new USHORT; *pInt = 10; std::cout << "*pInt: " << *pInt << endl; long * pLong = new long; *pLong = 90000; std::cout << "*pLong: " << *pLong << endl; *pInt = 20; std::cout << "*pInt: " << *pInt << endl; delete pInt; *pInt = …

Member Avatar for Moschops
0
124
Member Avatar for james6754

So in C# I can create an array of n elements: [CODE] int[] myArray = new int[n]; [/CODE] I have looked and it doesn't seem as though I can create an array like this in C++ (using new). Could anyone please explain why I cannot use new to create an …

Member Avatar for james6754
0
88
Member Avatar for james6754

Hi everyone, just learning c++ cannot for the life of me work out what is wrong with this code..? All I am getting is cout , undeclared identifier. Anyone help?

Member Avatar for WaltP
0
338
Member Avatar for james6754

Hi. I am trying to create a program to send data in real time from computer to computer. I am a bit unsure on how this will work with the server. I am thinking of serializing the objects and sending them through the server to be received by another user …

Member Avatar for Ketsuekiame
0
116
Member Avatar for james6754

[CODE] public delegate void myDel();//declare delegate static void Main(string[] args) { myDel Del; Thread myThread; program2 myOb = new program2(); Del = new myDel(myOb.helloMethod); myThread = new Thread(new ThreadStart(Del)); myThread.Start(); for (int i=0;i<100000;i++)//main thread { Console.WriteLine(i); } } } class program2 { public void helloMethod() { for (int i = …

Member Avatar for skatamatic
0
212
Member Avatar for dhija22

Well first of all you need a main method...then you should instantiate an object of type Person in the main method...then sent it two arguments (name,birthday). [CODE] public class person { private String Name; private String Birthday; public static void main(String[] args) { person ob = new person("Bill","21st October"); system.out.prinln(ob.getName); …

Member Avatar for NormR1
0
121
Member Avatar for jasonmrc

HMMM..well what you are doing there is trying to put a string value in to a char type... use single quotation marks...like this... [CODE] char G = 'g'; char M = 'm'; if ((textbox.text[6] == m) || (textbox.text[6] == g)) { messagebox.show( " iD is ok "); } else messagebox.show( …

Member Avatar for rikthefrog
0
111
Member Avatar for BCMusic24

It would help a great deal if you could post code and also explain a bit more what exactly your trying to achieve.

Member Avatar for nick.crane
0
91
Member Avatar for james6754

Does anybody think that in the future professional development will be done on other platforms using MonoDevelop? Therefore making C# multiplatform.

Member Avatar for Ketsuekiame
0
121
Member Avatar for james6754

I have this code.... [CODE] char ch; for (int i = 0; i < 10; i++) { ch = (char)('a' + i);//here Console.WriteLine(ch); ch = (char)((int)ch & 65503);//and here Console.WriteLine(ch + ""); Console.ReadLine(); } [/CODE] Now what I would like to ask is where ('a' + i) is, how is …

Member Avatar for Momerath
0
196
Member Avatar for james6754

Hello, I am looking for some information about how high level languages communicate with the lower levels of the computer. Hope this makes sense thanks.

Member Avatar for james6754
0
238
Member Avatar for danuz

How about.... [CODE] string[] romanNumerals = { //Roman Numerals in Here.... }; int input; Console.Write("Please enter the number you would like converting to numeral"); input = Convert.ToInt16(Console.ReadLine()); Console.Write(romanNumerals[input]); What you could also do is put all your roman numerals in to a text file and read each roman numeral in …

Member Avatar for stbuchok
0
176
Member Avatar for james6754

I am taking a step backwards in to C from C#. I am studying C# at University but feel I may be rather restricted as to what I can do later on. For that reason I would like to learn C (also to get a good idea about the real …

Member Avatar for Narue
0
172
Member Avatar for Roy Gourgi

Using Double numbers can be quite unpredictable. Try using the Math.Round() function to round off your results before adding them together.

Member Avatar for shams.expert
0
254
Member Avatar for MrBlack

Because when you do new Student(), all it is saying is run a new instance of class Student(run the constructor of the class). When you assign a new instance of Student to a variable of type Person, when you run sing and run methods of the object p1, the methods …

Member Avatar for Bridgekeepers
0
281
Member Avatar for james6754

Anyone let me know what is going on here? Think it is something to do with the scope. [CODE] double answer; if (sender is System.Windows.Forms.Button) { try { answer = Convert.ToDouble(answerBox.Text);//if cannot convert } catch (Exception ex) { MessageBox.Show("Enter a valid number" + ex.Message(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } …

Member Avatar for TheJohnSpecko
0
90
Member Avatar for johnt68

You are trying to hold a number in 'm_CardNumber' that is too large... use a 'long(int64)' instead, this should solve your problem.

Member Avatar for johnt68
0
140
Member Avatar for bleedi
Member Avatar for james6754

Anyone know what association is in C#. Someone I know is mentioning it and I cannot think what it is. The only thing I can think of is it being a 'has a' relationship e.g... [CODE] class Student : BankAccount { } [/CODE] Even still..this would still be coded in …

Member Avatar for Momerath
0
118
Member Avatar for james6754

Hi, I have added a SaveFileDialog to my project, to enable users to choose where they would like to save a txt file. I am using the Filter property to enable saving the file as a txt document, but when I run the project and the SaveFileDialog appears, the 'save …

Member Avatar for james6754
0
320
Member Avatar for james6754

I have a form, now if I were to make a new class and make the form inherit that class. That class changes to a form? Can anyone explain why. This is probably a really silly question but I cannot find an explanation for it! Thanks James

Member Avatar for abelLazm
0
99
Member Avatar for james6754

I am wanting to start a project for my own benefit. I would love to write my own commands for the Rovio but it is a bit too expensive for me. Does anyone know any cheaper alternatives that will allow you to use C#?

Member Avatar for Momerath
0
59
Member Avatar for simagen

Think this should be in the Computer Science section.... Logic gates are used inside a computer to give different outputs when certain states are met. This is a pretty good tutorial a quick search on Google gave me... [url]http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html[/url] If you want to know more there is also a great …

Member Avatar for abelLazm
0
201
Member Avatar for james6754

Is it good practice to do all instantiation inside the Main() method and not in any other classes?

Member Avatar for ddanbe
0
86
Member Avatar for james6754

We have been gives these classes as an example. In the student class the new keyword that is used on the print method... is it actually needed because you get the same result if it is taken out? [CODE] class Program { static void Main(string[] args) { Student s = …

Member Avatar for Momerath
0
94
Member Avatar for james6754

Hi. Implicit: the compiler does the work for you Explicit: you have to specify what you would like the compiler to do. are the above statements true? I have just read on MSDN that an abstract method is implicity virtual. One is not implemented and one is, so is this …

Member Avatar for ddanbe
0
137
Member Avatar for james6754

Hi, I am making a program where I am to ask the user a series of questions and add up the amount they get right blah blah.... I have to ask them the area of a square, the perimeter of the square along with other shapes.... So I was going …

Member Avatar for james6754
0
113
Member Avatar for neptunethought

[CODE] //use the WriteLine method of the StreamWriter class...like so... using (StreamWriter mywriter = new StreamWriter(//your file path here)) { mywriter.WriteLine("LINE 1"); mywriter.WriteLine("LINE 2"); } //or you could put values in an array and write each one using a foreach loop... string[] lines = { "LINE 1", "LINE 2", "LINE …

Member Avatar for Mitja Bonca
0
173
Member Avatar for revjim44

Hmmm...you are saying [CODE] passNameAr[position] == name; //passNameAr EQUALS name. seatAr[position] == seat; [/CODE] what you want is the value of name putting in to passNameAr[position]. [CODE] passNameAr[position] = name; //passNameAr is equal to the value of name seatAr[position] = seat; [/CODE]

Member Avatar for revjim44
0
128
Member Avatar for james6754

Ok..I am asking a similar sort of question... If I have a Form...I then take the values of of textboxes(user entered) and pass them in to the constructor of the class and set the attributes to the values passed in to the constructor. I know I can create objects myself …

Member Avatar for james6754
0
93
Member Avatar for james6754

Hi everyone...not usually in this part of DaniWeb... My friend is having massive problems with his internet explorer.. it keeps giving errors about .js (javascript?) Along with this you try to go on a site and it attemps to download a .cr file. Sometimes it loads just plain text, sometimes …

Member Avatar for vsmash
0
91
Member Avatar for james6754

I am taking on an assignment where I would like to give the user the chance to decide whether they would like to choose beginner or advanced. The way I was thinking of achieving this was by marking the method virtual and overriding another method for when an object of …

Member Avatar for Momerath
0
71
Member Avatar for james6754

I have this... [CODE] class Program { static void Main(string[] args) { Console.WriteLine("Please enter name of DVD"); object objectname = Console.ReadLine(); Program2 myob = new Program2(objectname); } public int number = 0; public string myString = "DVD"; public double myDouble = 2.0; } class Program2 { public Program2(object objectname) { …

Member Avatar for Kru
0
118
Member Avatar for danuz
Member Avatar for james6754

Hi everyone, I have asked something similar to this before. I understand how to use objects and what they do etc... What I am struggling to get my head around is WHAT an object actually is. I keep reading and reading but do not seem to be able to get …

Member Avatar for Momerath
0
143
Member Avatar for james6754

Hi everyone...I have this [CODE] abstract class Program { static void Main(string[] args) { } public abstract void m1(); } class Program2 : Program { public override void m1() { } } [/CODE] I inherit Program and implement the method m1(), can anyone explain in a simple way why I …

Member Avatar for Momerath
0
109
Member Avatar for revjim44

Hi mate... [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Lab4_2 { class Program { // ReadDials method initial code static char ReadDials(string PhoneNo, int myCounter) { char holder; holder = (char)PhoneNo[myCounter]; return holder; } static void Main(string[] args) { char d1, d2, d3, d4, d5, d6, d7, …

Member Avatar for Ketsuekiame
0
382
Member Avatar for 5ophie2012

[CODE] string filepath = (@"C:\Documents and Settings\andre clements\Desktop\file.txt"); int val = Convert.ToInt32(char passed in);//this would be the char passed in to method string hex = string.Format("{0:X}", val); using (StreamWriter writer = new StreamWriter(filepath)) { writer.Write(hex + " ");//hex value plus 2 spaces.. } [/CODE]

Member Avatar for Ketsuekiame
0
2K
Member Avatar for revjim44

Your problem is between lines 87 - 89. I'm not really sure what the requirements are. "If fourth digit is not a hyphen then return an error code?". When errorflag is passed in to readdials from todigit, it is being set to -4. Therefore causing "ERROR - Hyphen is not …

Member Avatar for Mitja Bonca
0
409
Member Avatar for onlinessp

Well when you enter command line arguments they are stored in the args array.. [CODE] static void Main(string[] args) //"someinput" would be stored in here. { string a=Console.ReadLine(); //this is wrong..Console.ReadLine() reads input from the user when enter is pressed Console.WriteLine(a); Console.ReadKey(); } [/CODE] [CODE] static void Main(string[] args) { …

Member Avatar for james6754
0
242
Member Avatar for taylby

have you set a breakpoint to see what is happening..you can then step through the code with f11.. something is obviously being run somewhere whenever you load your form... post more code so we can see what is happening..

Member Avatar for taylby
0
152
Member Avatar for ctsmith84

I have been programming with C# now for around 3 and a half months now and I think I have come on no end (although I probably have not). The guys here have been a MASSIVE help and I love nothing more than reading through all the posts on DaniWeb. …

Member Avatar for ctsmith84
0
205
Member Avatar for 5ophie2012

[QUOTE] I'm lost as to how to create/call methods...I'm just completely lost in general. All help will be appreciated![/QUOTE] Sounds like you need to get a good book and do some reading on OOP (Object Oriented Programming). Here is a good website that will help you understand the principles of …

Member Avatar for james6754
0
158
Member Avatar for justin3085

return a random number..?? in what context do you mean??? to get a random number..use the next method of the random class.... [CODE] Random myRand = new Random(); MessageBox.Show(myRand.Next(1,100)); //this will return a number between 1 and 100. is this what you want? [/CODE]

Member Avatar for justin3085
0
421
Member Avatar for CHOCHOCHO

This may sound silly but the program does not have to actually work right?? just show message boxes when you click the buttons??

Member Avatar for CHOCHOCHO
0
120
Member Avatar for james6754

I understand how to use properties. What I would like to know is... Properties are designed to stop direct access to an variable Can anyone give an example where if the property was not used and the variable was written to directly..this would cause a problem? Thanks James

Member Avatar for ddanbe
0
69
Member Avatar for writecharlie
Member Avatar for moone009

well then you can use if statements in the for loop.. [CODE] foreach (string line in lines) { if (line == "text your looking for") { Console.WriteLine("YOU HAVE A MATCH"); } else if { Console.WriteLine("YOU DONT HAVE A MATCH"); } } [/CODE]

Member Avatar for Mitja Bonca
0
5K

The End.