698 Posted Topics
Re: The ListBox's Item collection is of the 'object' type. The value displayed in the listbox is the result of the ToString() method of the object. If you override the ToString() method of your struct you can determine what is returned, and thus, what is displayed in the ListBox if you … | |
Re: Alternatively, you can use IF ELSE in queries with SQL Server 2000 or newer. You can check if the item exists, if it doesn't then insert it. I have done something like this in the past: IF EXISTS ( SELECT * FROM user_table WHERE userid = @userID ) BEGIN SELECT … | |
Its been a few years since i've coded any network applications so I was hoping for some suggestions on the best approach. I have written two programs which i now need to have them communicate with one another. They are both running on a LAN (over VPN) with static IP … | |
Re: [QUOTE=mshauny;1333983]yes, as an output it will make it 9, but i guess you never understood the question. he wanted to keep it with the length 9, not just for output. [/QUOTE] What Momerath offered was an alternative solution. Daniweb is a place for exchanging ideas and advise..there is no "one … | |
Re: if you want to be able to alter something after it is drawn you will need to store each object you draw in some way. I would recommend creating some classes. Create a base class for drawn objects that stores common details (location, colour, etc) then create some subclasses which … | |
Re: @mono_jit23: Your code would only split the values into a single array, the OP needs Numbers in one array and operators in another. @rutul: The problem you are going to have is dimensioning your arrays as you wont know how many Numbers and how many operators your string holds until … | |
Re: Check out the [URL="http://msdn.microsoft.com/en-us/library/486wc64h.aspx"]Control.FindControl[/URL] method :) | |
Re: Before I answer your question, I just want to cover a couple of things that you ought to know about this code: [CODE]if btAdd_Click() = true;[/CODE] Firstly, if you are [B]comparing[/B] objects you need to use the "equal to" operator which in C# is [iCODE]==[/iCODE]. ie [iCODE]if(x == y)[/iCODE]. When … | |
Re: If you have attached an event handler to the CellValidating event then it will always fire when focus leaves the cell. If there are cells that you dont want to validate (eg read only cells) then add a check at the start of the event handler that will cause it … | |
Re: Welcome to Daniweb, but please read the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]forum rules[/URL] before posting. It is against the rules to "piggyback another" thread, if you have a question, start a new thread in the relevant forum. Also, here at Daniweb, we request that posters make an effort on their own before posting so … | |
Re: Hi udaraps. Please try not to resurrect old threads. Also, this is the C# forum, you woul dprobably have better luck posting your question over on the [URL="http://www.daniweb.com/forums/forum4.html"]VB 4/5/6 board[/URL]. | |
Re: If the string is empty then the match will fail anyway since you require 1 or more of the first character. You will possibly throw an exception if you try a regex search on a null string so your better to check for null first, and if not null, then … | |
Re: What is it you are trying to validate? You can't use start > stop or start < stop because you haven't got a date to determine order. For instance, if start date is 22:00 and stop date is 07:00 you cant tell if its 7am the following day (which is … | |
Re: If you are ever unsure about which event to use you can always check the [URL="http://msdn.microsoft.com/en-gb/library/ms123401.aspx"]msdn reference[/URL] for the class/control you are using. It has a very comprehensive [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview_events.aspx"]list of the events[/URL] and when they are raised: [QUOTE] CellEndEdit: Occurs when edit mode stops for the currently selected cell. [/QUOTE] | |
Re: I would recommend you look into the [URL="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx"]BackGroundWorker[/URL] class. Its a useful wrapper for thread classes that provides Reporting, Cancelling and Result methods. You attach a method to the class which is then run in a separate thread. Within that method you can call ReportProgress method which can be used … | |
Re: You should generally use Scope_Identity over @@Identity as @@Identity is connection based and may not reflect the last added row. Just so that i have it clear in my head, this is how i understand your order of execution: -Populate CheckedList with Authors -User enters details for a book -Add … | |
Re: You'll need to fix the following as well as implementing your search: [CODE]DateTime search1 = new DateTime(); string s = search1.ToString(Console.ReadLine());[/CODE] You have misused the overload of ToString. Where you have passed it Console.Readline() the method is expecting a format string to determine how to construct the string. You need … | |
Re: You can use DateTime.TryParse to convert each entered time into a DateTime. If it fails then you can alert the user: [CODE] static void Main(string[] args) { string startTime = Console.ReadLine(); string stopTime = Console.ReadLine(); DateTime start; DateTime stop; if (!DateTime.TryParse(startTime, out start)) { Console.WriteLine("Invlaid Start Time"); } if(!DateTime.TryParse(stopTime, out … | |
Re: [QUOTE=Momerath;1328736]It will work if your goal is to briefly show the form then close it. [I]myform[/I] is a local variable and thus will go out of scope as soon as this method ends. This will cause [I]myform[/I] to immediately close. You need to rethink your form handling.[/QUOTE] You would think … | |
Re: You could replace your SetB method with a property to access b, that way you can guarantee that the flag gets set regardless of where you change b from: [CODE] bool bHasChanged = false; int a; int _b; public int b { get { return _b; } set { bHasChanged … | |
Re: As an aside, you should generally store and check a hash of the password rather than the password itself as this is more secure. If the answers you have been given helped, please remember to mark this thread as solved :) | |
Re: Firstly, please don't bump your threads...especially with duplicate posts. Secondly, if you are ever unsure of sql syntax there are great references online such as [URL="http://www.w3schools.com/sql/sql_update.asp"]W3CSchools[/URL]. You'll see in the link that the syntax you need is "UPDATE tablename SET column1 = @value1 WHERE column2 = @value2". Correct your update … | |
Re: Nope, Windows Presentation Foundation allows you to produce move interactive and visually enhanced windows applications. I really [B]must[/B] find the time to get to grips with it myself :D | |
Re: please use [noparse][CODE][/CODE][/noparse] tags when posting code. What is DateAndTime in your code? | |
Re: @rohand, I agree; rather than retrieving the list of words then having to iterate through them. Pass the body of the message to the database and use a LIKE condition. The database will be able to perform the match this way much quicker and more efficiently than any loop you … | |
Re: Are you opening Form2 from Form1? Is Form2 opened modally (ShowDialog())? If you aren't showing it modally then check out my tutorial for [URL="http://www.daniweb.com/code/snippet298708.html"]accessing controls across forms[/URL] If you are showing it modally then you can add a public property to Form2 that returns the image and use that from … | |
Re: I'm not sure if it can be translated to a control, but ddanbe posted a snippet a while back that [URL="http://www.daniweb.com/code/snippet227743.html"]rotated a string with a timer[/URL]. See if it inspires you :) | |
Re: Definitely like the new rules :) Much easier. I agree that numbering the sections would help to point rule breakers to the relevant section..but at the same time, the rules are concise enough that it isn't a major issue; they should really read them all anyway :p What would that … | |
Re: Your "getters and setters" are called properties. You can declare them in an interface (see [URL="http://msdn.microsoft.com/en-us/library/64syzecx(VS.80).aspx"]MSDN[/URL] for example). I haven't worked with COM classes for C++ so i don't know if there are additional restraints on the interface you create...hope this gets you in the right direction at least. | |
Re: If MethodA doesnt have to run before B and C then you could use a do..while loop: [CODE] int i = 0; do { MethodB(); MethodC(); i++; } while (MethodA() != 0 && i < 5); [/CODE] |
The End.