128 Posted Topics
Re: [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 | |
[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 = … | |
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 … | |
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? | |
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 … | |
[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 = … | |
Re: 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); … | |
Re: 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( … | |
Re: It would help a great deal if you could post code and also explain a bit more what exactly your trying to achieve. | |
Does anybody think that in the future professional development will be done on other platforms using MonoDevelop? Therefore making C# multiplatform. | |
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 … | |
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. | |
Re: 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 … ![]() | |
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 … | |
Re: Using Double numbers can be quite unpredictable. Try using the Math.Round() function to round off your results before adding them together. | |
Re: 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 … | |
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; } } … | |
Re: You are trying to hold a number in 'm_CardNumber' that is too large... use a 'long(int64)' instead, this should solve your problem. | |
Re: Can you post your code.. | |
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 … | |
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 … | |
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 | |
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#? | |
Re: 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 … | |
Is it good practice to do all instantiation inside the Main() method and not in any other classes? | |
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 = … | |
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 … | |
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 … | |
Re: [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 … | |
Re: 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] | |
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 … | |
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 … | |
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 … | |
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) { … | |
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 … | |
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 … | |
Re: 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, … | |
Re: [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] | |
Re: 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 … | |
Re: 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) { … | |
Re: 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.. | |
Re: 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. … | |
Re: [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 … | |
Re: 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] | |
Re: This may sound silly but the program does not have to actually work right?? just show message boxes when you click the buttons?? | |
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 | |
Re: is it the select from menu part that you are stuck with? | |
Re: 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] |
The End.