2,157 Posted Topics
Re: In C#, for reference types, the '==' operator compares the references to see if they reference the same object. The Equals() method compares the internal values to see if they have the same values. So in this case you can use the Equals() method[code]if (o1.Equals(o2)) { // code here }[/code] | |
Re: I've never heard that, whatever that's worth :) You'll be violating first normal form if you provide both an identity key and an account key, but sometimes that's just what you have to do. I'd put a trigger on the insert and set account = id if account is null. | |
Re: Why don't you display it and see? | |
Re: Use Value not InnerText. | |
Re: You really think after 3 years they are still looking for an answer? | |
Re: Was there a question there? StringBuilider allocates space based on how it percieves what it will need. This makes it more effecient for appending strings to it (vs using String which has to allocate new memory every time you add something to it). | |
Re: In C#, everything belongs to something. In the case of static variables, they belong to the class. So you must (as tinstaafl said) proceed them with the class name (basically, we won't go into using and things now). Non-static variable belong to instances of classes, so you proceed *them* with … | |
Re: Try this double[,] myArray = new double[3,4]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) { Console.Write("Input value for position [{0}, {1}] : ", i, j); myArray[i,j] = double.Parse(Console.ReadLine()); } } There is no error checking in there, so … | |
Re: What do you want to replace it with? | |
Re: You are trying to ensure that only numbers are entered (with the appropriate decimal specifier, if needed). Regex and Try/Catch are slow ways to do this, just use TryParse: double value = 0.0; if (Double.TryParse(myTextBox.Text, out value)) { // it is convertable to a double, so we are good and … | |
Re: You shouldn't be holding those DateTime values outside the method that checks if it is the right time. Redo your logic. More information about what you are trying to do might help us come up with a better method. Do you want the routine to run over and over again … | |
Re: Depends on how you've coded the logic of the form. this.Hide() should do what you want. | |
Re: Try this public void Circles() { Graphics g = panel1.CreateGraphics; if (counter > 0) { using (Pen redPen = new Pen(Color.Red)) { g.DrawEllipse(redPen, panel1.Width / 2, panel1. Height / 2, 75, 75); } } if (counter > 1) { using (Pen bluePen = new Pen(Color.Blue)) { g.DrawEllipse(bluePen, panel1.Width / 2, … | |
Re: I'm getting a match here, not sure why you aren't (using your example from the first post and the code from the last post). | |
Re: Methods have four parts: <access> <return type> <name> <parameters>, so public Npc GetData(int id) { | |
Re: It means you have a line that doesn't have a ',' character in it. Most likely it is the last line of the file. Try checking for an empty line before you split it. info = myReader.ReadLine(); if (info == null) break; if (info.Trim() != String.Empty) { string[] words = … | |
Re: How are the images displayed in the panel? Are you drawing them onto the panel, onto its background, etc. | |
Re: Why do you think it isn't inserting? When you check the database after you've run your program it isn't there? | |
Re: Use GetSelectedItem to get the object, then just call the methods. | |
| |
Re: Line 21 you create list of senior students in the junior students class. You add the students to this list when you promote them. *This does not do anything to the list contained in the senior students class*. How could it? | |
Re: Create all your buttons, you don't need them in an array (unless there is some specific reason you do). Create one handler event and use the sender parameter to get the button that was clicked. Set all the clicked events to this handler. Get the current color and figure out … | |
Re: 4 milliseconds seems about right to obtain a lock. You have to remember that code is going to take time to run. Why do you need the time written to a file exactly on the millisecond? tinstaafl: Using the forms timer is subject to GUI updating. It only guarentees that … | |
Re: The methods you describe are exactly the same in effort, so it doesn't matter which you use. Personally, I'd go with the first one. What I'd look for is the smallest area I can search that indicates a different piece rather than trying to match the entire piece image. Depending … | |
Re: TreeView has a TreeViewNodesCollection which is basically an array of TreeNode objects. A TreeNode also has an array of TreeNode objects for its children. | |
Re: It isn't caused by deadlock, it's causes because only the UI thread can perform UI operations. In a Winforms application it is the main thread that is the UI thread. You start a thread and attempt to call ShowDialog in that thread. Doesn't work that way. Call UI stuff in … | |
Re: Since you clear the table in line 14 there are no other rooms that are booked. Otherwise you'll have to search the table and see if the room is booked, or set a unique constraint on the column (not sure if you can do that with DataTables, I don't use … | |
Re: In C, anything that is not zero is true, while zero is false. C# doesn't work that way and requires a boolean value for conditionals. So you need to compare that to something if (back_tracing(0, y + 1) != 0) { // true, do whatever } | |
Re: Something like String str = //your string here MatchCollection matches = Regex.Matches(str, "(?<=sizeableIcon:)(.*?)(?=;)"); foreach (Match match in matches) { //do something with each match } | |
Re: You have an exception block with an empty catch, put something in there. Check to see if Mappings is null. | |
Re: There are many different string searching algorithms. Depending on what you are searching for, how long the strings are, etc. will effect the efficiency of these algorithms. So, what are you searching for? Are you searching the same string multiple times? How long is the search string? How long is … | |
Re: Same answer as the last time you asked this, 5 days ago: [Dragon Book](http://dragonbook.stanford.edu/) | |
Re: Did you bother to do a search? http://blogs.msdn.com/b/ericlippert/archive/2010/07/22/graph-colouring-with-simple-backtracking-part-three.aspx | |
Re: It would be easier for you to share the entire project using something like Github. It would also serve as a version control system for you. and to answer your questions, everything with .cs on the end you'll need. You can just use Add Existing on them. | |
Re: I'd ask the author of the CVSReader, since the error is occuring in their code. As a guess, I'd say it's creating column headers when you access FieldCount and their are duplicate column names. | |
Re: http://www.codeproject.com/Articles/6847/Map-Network-Drive-API | |
Re: It's "Guest_ID" not "guest_ID" and "Phone_number" not "phone_number" | |
Re: BeginExecuteNonQuery is for async operations and requires an EndExecuteNonQuery call for it to 'finish' the command. From the documentation: The BeginExecuteNonQuery method starts the process of asynchronously executing a Transact-SQL statement or stored procedure that does not return rows, so that other tasks can run concurrently while the statement is … | |
Re: Works here, you have the latest version? | |
Re: According to Microsoft: Following are some of the reasons to use native XML features in SQL Server instead of managing your XML data in the file system: You want to share, query, and modify your XML data in an efficient and transacted way. Fine-grained data access is important to your … | |
Re: Parallel arrays should rarely be used, and this isn't one of the rare occations. Learn to use classes, you have an employee who has a department, hours and wage. Sounds like three properties to me. You can even add a property to give total pay for that employee. That said, … | |
Re: Same problem as your other post. | |
Re: Your num2, etc. are all under the first if condition in line 27. | |
Re: You can include the database file with your software, but if you want *everyone* to share data, you'll need a central data location. Depending on how up-to-date you need everyone to be you can do local updates at specific times. | |
Re: Maintain a separate list of all the post codes and display the matching ones as they type. You can also do partial look ups as they type (in a separate thread) so when they finish you have already retrieved part of the data. | |
Re: If you are using the hard coded 127.0.0.1, of course it doesn't work. Try using the IP of the host. | |
![]() | Re: Put a breakpoint at line 6 and ensure that you are getting 'grass' as the first element. |
Re: Where does 'google_response' come from and why aren't you calling GetResponse() on the 'google_request' object, just like documentation at MSDN says? |
The End.