698 Posted Topics
Re: @spdesigns, please use [noparse][CODE][/CODE][/noparse] tags when posting code. It maintains formatting and makes your code much more readable. @dan1992, you need to append the name of the folder you are moving to the end of your destination string. The Destination parameter of the Directory.Move method specifies the path of the … | |
Re: Lets break it down: [iCODE]int? count[/iCODE] declares a [URL="http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx"]nullable[/URL] integer variable named count. count is now a variable which can store either an integer value or NULL. [CODE] (from cartItems in storeDB.Carts where cartItems.CartId == shoppingCartId select (int?)cartItems.Count).Sum();[/CODE] This is a [URL="http://msdn.microsoft.com/en-us/library/bb383978.aspx"]LINQ query[/URL] which returns the Count of the cartItems … | |
Re: Some coders feel that 'var' reduces code noise and makes their code more readable. In the statement [iCODE]List<string> genres = new List<string>[/iCODE] the initial type declaration is redundant because the value assignment makes it clear what type the variable is. Using [iCODE]var gernes = new List<string>[/iCODE] makes it shorter, more … | |
Re: There is a CellValidating and CellValidated event, but these also fire when the user finishes entering data. Its generally common practice to validate the input [B]after[/B] the user finishes; i know i would be annoyed if every typo caused an "Invalid Entry" error of some sort to flash up before … | |
Re: You can attach an event handler to the second form's Closed event when you open it and call code when it fires: [CODE] public partial class Parent : Form { public Parent() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Child child = new Child(); //create new isntance … | |
Re: I'm with nick on this one, if radiobuttons in panels automatically have one checked then this is new behaviour for 2010 because vs2005 and vs2008 have not exhibited it. Likewise, the Paint event is a bad place to put that code, it will clear the users selection every time the … | |
Re: Im not sure whats preventing the font from loading on some computers. But i do have a tip for you; rather than setting the fonts of every textbox and button you can group them together in Panels then set the font on the panel. By default, controls inherit the font … | |
Re: Check the event handlers as Lusipher mentioned, and also check they definitely aren't sharing a binding source. I scanned over the code in the link and for the second grid to move forward a page its datasource would have to have its filter changed. The filter is only changed in … | |
Re: Have you tried checking the index before attempting to access it? In fact, if index is -1 then you can skip the whole method since you are trying to draw an item that isnt in the list so: [CODE] private void Browsers_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if(e.Index<0) return; //rest of … | |
Re: Handy code. I would make one small suggestion though. Rather than retrieving the CheckedIndexCollection and nesting it, you can make the code much more readable by using a foreach loop: [CODE] int n = 0; foreach (ListViewItem item in listView1.CheckedItems) { sTemp[n] = item.Text; n++; } [/CODE] I've added a … | |
Re: I pasted this section into a console app: [CODE] while (true) { string choice = Console.ReadLine(); string[] spl = choice.Split('/'); switch (spl[0]) { case "help": switch (spl[1]) { case "programs": Console.WriteLine("Available programs commands are:"); Console.WriteLine("Run, Manage, list."); break; case "files": Console.WriteLine("Available files commands are:"); Console.WriteLine("Open, Delete, lock, list."); break; default: … | |
Re: I wrote [URL="http://www.daniweb.com/code/snippet245270.html"]a tutorial[/URL] a while back that covers some elements of classes and objects. Other than that, there is lots of material online if you google it or check out the msdn reference. | |
Re: Are you running the query in SQL Server 2005 or somewhere in your C# code? I ran your code in a query on sql server 2008 and it created the table fine. Your syntax isnt at fault; does the table already exist? are you correctly connected to the sql server … | |
Re: The Control.Validating event is only raised when the control loses focus so to validate all controls you would have to iterate through them giving them each focus. If you have created each validation method to return a bool (as you show above) then you can check the status of each … | |
Re: If i have understood you correctly, then what you need is txtReminder.Focus(). | |
Re: You can use [icode]dataGridView.Rows[0].Cells[0].Selected = true;[/icode] to select specific cells. You will need to iterate through the cells and check their values against the textbox text to determine whether they should be selected or not. | |
Re: please do not resurrect old threads to post new questions. Also, we have a strict policy here at daniweb to help thosde who show effort. Since this thread was solved, read through the code given and try to modify it to meet your own requirements, then post your own question … | |
Re: The code in your Tick event runs every time the timer's interval has elapsed. SO if your interval is set to 1 second (ie 1000 ms) then once every second you are displaying a countdown from intTimeDelay to 1. You need to store the remaining time in a variable [B]outside[/B] … | |
Re: If your not going to add/remove items then you could hard code it as a [URL="http://msdn.microsoft.com/en-us/library/xfhwa508.aspx"]dictionary[/URL]. Otherwise you'll need a storage method that allows add, delete and query..database being the most powerful, or a textfile with relevant methods being an alternative. If you just want to tidy up the code … | |
Re: You have commented out the lines that initialise the shape.shapeTile objects so shape.ShapeTile[0] == null. Also, you are looping on q and w but dont seem to be using them..should they be used to determine which square you are checking against board.recTile[b, c] ? | |
![]() | Re: What exactly is the problem when you try to use the .cur file? Does it not load or does it load incorrectly? Bear in mind that the Cursor class only supports black and White cursors: [QUOTE]Note The Cursor class does not support animated cursors (.ani files) or cursors with colors … ![]() |
Re: You could create a class to store each object, place them in a generic list and use the List<T>.Find() method to search for them. Alternatively, if you are on .net 3.5 you can use [URL="http://msdn.microsoft.com/en-us/library/bb397919.aspx"]LINQ to Objects[/URL] to query an array. | |
Re: Unless there is something specific in either the development environment or the language version that you want, i would suggest you stick with what you are comfortable with. I only moved to 2008 because a lot of the posters here use it and i was tired of not being able … | |
Re: You can store both items in the same file, just separate them with a delimiter (such as ; or ,). Look at [URL="http://msdn.microsoft.com/en-us/library/aa287535(VS.71).aspx"]this[/URL] to see how to read in each line of the file. You then need to extract your title and url from the line, run the code to … | |
Re: At a guess i would say your element isnt being found. Have you double checked the ID of the page once it is loaded? Bearing in mind that id's often have the ID of their container appended to their own ID to ensure uniqueness; ie, a button with ID = … | |
Re: Are you loading the values from a database or manually? | |
Re: Seriously? This [I]again[/I]? Have you tried any of the suggestions from [URL="http://www.daniweb.com/forums/thread287708.html"]this post[/URL], or [URL="http://www.daniweb.com/forums/thread290538.html"]this one[/URL]...maybe [URL="http://www.daniweb.com/forums/thread293510.html"]this one[/URL]? Please don't flood the boards with the same question. If you absolutely must ask for further advise then psot in your original thread, it will be refreshed and bumped to the top … | |
Re: You can concatenate the selected values into a comma-separated list then use the IN operator like "Select * FROM Emp Where EmpNo IN (1,2,3,4)" | |
Re: If you plan to add and remove elements i would suggest looking at [URL="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx"]generic lists[/URL]. You can create a List<string> then add and remove elements. It resizes dynamically and automatically moves the elements down when one is removed. | |
Re: mvkotekar, a few pointers: One - if someone is clearly doing a homework piece we generally give guidance and pointers rather than complete code as it deprives them of the chance to learn by getting there for themselves if they can copy and paste a solution. Two - please use … | |
Re: Just so i'm clear, did you mean: [CODE] int x; int y = x; y = 1; //x now also equals 1 [/CODE] If you mean the code above then no, it wouldnt work. What you are looking at here is the difference between [URL="http://msdn.microsoft.com/en-us/library/t63sy5hs(VS.80).aspx"]a value and a reference type[/URL]. … | |
Re: Nick is correct, if you are removing item you should start at the end and work forwards. Imagine your index is zero, the item at index zero is all spaces so you remove it. The items in the collection will then move down into the space so item one becomes … | |
Re: If you have created the class in the same project you just instantiate it the same way you do other classes: [CODE] //if you created a class called MyClass with a method called DoStuff //then you would call it like this: MyClass class = new MyClass(); //create instance of class … ![]() | |
Re: You can use the Broswer.Document.Window.ScrollTo() method to move the view to a point in the webpage. The following code scrolls to the bottom right of the page. You would need to use some logic to determine what point on the page you want to scroll to: [CODE] Point p = … | |
Re: Be aware, the transparency in C# forms is not [I]true[/I] transparency. It will apply the background image/colour of the controls parent. You wont be able to see other controls through the control on top. | |
Re: If you are using ShowDialog to display the child form modally then i would recommend exposing the data via a property: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Button_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); if(frm2.ShowDialog() == DialogResult.OK) { … | |
Re: The GridView is a System.Web.UI control used in ASP.net designs and has a SelectedRow property. If you have the SelectedRows property then it sounds like you are using a DataGridView which is part of the System.Windows.Form namespace. The DataGridView allows multiple rows to be selected and returns them as a … | |
Re: Firstly, the coloured text is intended to highlight parts of your post...not all of it. Secondly, try to use titles that describe your problem. What you want is info on "Accessing Files on Remote Server". If you have a connection to the remote machine you should be able to access … | |
Re: I agree with the general sentiment here...why are you trying to reinvent the wheel? Also, just a note to rohand; String.ToCharArray() is redundant...a [URL="http://msdn.microsoft.com/en-us/library/system.string(v=VS.71).aspx"]string[/URL] [B]is[/B] an array of characters :) [CODE] class Program { static void Main(string[] args) { string test = "test"; //string as char array: //iterate through char … | |
Re: Strings are an imuutable type. You dont directly change their value, you assign a new value to them. As such, their functions do not change their value. For example: [CODE] class Program { static void Main(string[] args) { string test = "This is a test"; Console.WriteLine("Initial value: {0}", test); test.Replace(" … | |
Re: Whilst a string may often behave like a value type it is in fact an Immutable Reference type. Some extra behaviours (such as value comparisons and value reassignments) have been added for convenience but they are still a reference type at the core...thats why string.Replace() doesnt affect the string but … | |
Re: The event you need is [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted.aspx"]DocumentCompleted[/URL], it fires when the document finishes loading. I'm not sure about your image question. Theres no straightfoward method that i know of (which doesnt mean there isnt one, just means i havent seen it yet :)). | |
Re: Try debugging your code and checking the value of your DateTime [COLOR="Red"]before[/COLOR] you try converting it. A DateTime holds a value like "03/08/2010 10:35:46" which is what you say you need. Also, you would want to use DateTime.Parse if you wanted to build the date as a string and convert … | |
Re: I generally post tutorials as Code Snippets, not ideal, but it makes them easier to find in my profile if i want to link someone to them. As for open source project, it sounds great but theres one problem...everyone here at daniweb is too busy doing other peoples homework ;) | |
Re: Rather than creating your new form inside your login method, keep your login method purely for validating the user then create the form based on its return value: [CODE] private void button1_Click(object sender, EventArgs e) { bool Validated = login(txt_username.Text, txt_password.Text); if(Validated) { //show form } else { //notify user … | |
Re: Have you checked to ensure your firewalls are allowing traffic on the port you are using? | |
Re: Unless you are storing the previous value anywhere it is only accessible during the CellValidating event which only fires when a cell loses focus. You said you want to compare the current value to the value 10 minutes ago; If you are updating the value every 5 minutes then you … | |
Re: Please try to be more specific when posting a question. The better we understand the problem, the more likely it is that we can offer the help you need. If you just need general information about a type/namespace in C# then a search on the msdn website should always be … | |
Re: I agree with ddanbe; If you are comfortable with threadign then move the process to a seperate thread from UI and use sleep to pause it between iterations. Otherwise, you can put the loop into a timers tick event. You would need to amend the way you write your loop … |
The End.