698 Posted Topics

Member Avatar for dan1992

@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 …

Member Avatar for Geekitygeek
0
110
Member Avatar for johndoe444

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 …

Member Avatar for Geekitygeek
0
161
Member Avatar for johndoe444

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 …

Member Avatar for Geekitygeek
0
115
Member Avatar for judithSampathwa

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 …

Member Avatar for Geekitygeek
0
74
Member Avatar for AngelicOne

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 …

Member Avatar for AngelicOne
0
10K
Member Avatar for judithSampathwa

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 …

Member Avatar for judithSampathwa
0
1K
Member Avatar for trippinz

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 …

Member Avatar for trippinz
1
279
Member Avatar for markthien

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 …

Member Avatar for nick.crane
0
170
Member Avatar for sathya8819
Member Avatar for jackabascal

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 …

Member Avatar for Geekitygeek
0
355
Member Avatar for LevyDee

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 …

Member Avatar for Geekitygeek
0
2K
Member Avatar for yeturbumi

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: …

Member Avatar for Geekitygeek
0
210
Member Avatar for hellkosmos

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.

Member Avatar for hellkosmos
0
129
Member Avatar for AngelicOne

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 …

Member Avatar for nick.crane
0
118
Member Avatar for AngelicOne

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 …

Member Avatar for Geekitygeek
0
400
Member Avatar for imso
Member Avatar for nick.crane
0
138
Member Avatar for Hardz

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.

Member Avatar for Hardz
0
959
Member Avatar for avirag

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 …

Member Avatar for Geekitygeek
-1
3K
Member Avatar for imso

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] …

Member Avatar for Geekitygeek
0
423
Member Avatar for GAME

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 …

Member Avatar for PierlucSS
0
109
Member Avatar for DaveTELFA

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] ?

Member Avatar for DaveTELFA
0
176
Member Avatar for nssltd

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 …

Member Avatar for nssltd
1
364
Member Avatar for Samamam

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.

Member Avatar for Samamam
0
141
Member Avatar for Lazarevsky

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 …

Member Avatar for Lazarevsky
0
142
Member Avatar for mr3army

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 …

Member Avatar for Geekitygeek
0
89
Member Avatar for mr3army

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 = …

Member Avatar for Geekitygeek
0
4K
Member Avatar for empyrean
Member Avatar for judithSampathwa

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 …

Member Avatar for Geekitygeek
0
294
Member Avatar for Prashant387

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)"

Member Avatar for Geekitygeek
0
143
Member Avatar for DaveTran

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.

Member Avatar for nick.crane
1
3K
Member Avatar for charlie81

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 …

Member Avatar for mvkotekar
0
162
Member Avatar for bbman

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]. …

Member Avatar for bbman
0
104
Member Avatar for GAME

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 …

Member Avatar for Geekitygeek
0
137
Member Avatar for Don_leon

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 …

Member Avatar for saravind84
0
123
Member Avatar for Suzie999

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 = …

Member Avatar for Suzie999
0
167
Member Avatar for solid2005

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.

Member Avatar for Geekitygeek
0
122
Member Avatar for rjthomas8

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) { …

Member Avatar for Geekitygeek
0
156
Member Avatar for rjthomas8

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 …

Member Avatar for Geekitygeek
0
611
Member Avatar for Nitin Daphale

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 …

Member Avatar for Geekitygeek
0
89
Member Avatar for swetz

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 …

Member Avatar for Geekitygeek
0
367
Member Avatar for darren_88

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(" …

Member Avatar for Geekitygeek
0
140
Member Avatar for BhuvanRam

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 …

Member Avatar for gusano79
0
315
Member Avatar for g2gayan

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 :)).

Member Avatar for g2gayan
0
195
Member Avatar for BonaDrag

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 …

Member Avatar for BonaDrag
0
2K
Member Avatar for cwarn23

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 ;)

Member Avatar for Geekitygeek
0
167
Member Avatar for manavsm

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 …

Member Avatar for raj_developer
0
357
Member Avatar for ankitpsaraogi
Member Avatar for ankitpsaraogi
0
168
Member Avatar for shane711

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 …

Member Avatar for Geekitygeek
0
194
Member Avatar for pamikrom

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 …

Member Avatar for Geekitygeek
0
93
Member Avatar for wade2462

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 …

Member Avatar for Geekitygeek
0
152

The End.