2,157 Posted Topics
Re: [URL="http://msdn.microsoft.com/en-us/library/system.console.aspx"]Console[/URL] [URL="http://msdn.microsoft.com/en-us/library/system.string.aspx"]String[/URL] Everything you need is on those two pages. Post what you have as we aren't a homework service. | |
Re: [code]Random r = new Random(); private string Method() { String[] myString = File.ReadAllLines("myfilename.txt"); return myString[r.Next(myString.Length)]; }[/code] Never put the new Random in a method that might be called repeatedly, you won't like the results. Put it outside the method, or in the constructor. If you are trying for 'random access' … | |
Re: [code]private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndices.Count > 0) { button1.Enabled = true; } else { button1.Enabled = false; } } [/code] | |
Re: It gives the current memory usages. If you don't have objects created for the forms, then it doesn't include them in the size. If you want maximum memory usage you'll have to create all the objects that could ever be created by your code before you check memory size. I'm … | |
Re: [code]myString = MyString.PadRight(1000);[/code] Adds spaces to the right side of the string until it is 1000 characters in length. | |
Re: [URL="http://mediainfo.sourceforge.net/en"]Mediainfo[/URL] is another one. And you just need to reference the DLLs. | |
Re: Properties don't have parameters. Your line 20 says that the method GetCount has zero parameters, which is not the same as not having them. Change the line to [code]public int GetCount { get { return n; } }[/code] readonly isn't needed as you don't provide a set method so there … | |
Re: I once had a user (back in my mainframe days) who couldn't understand why her daily reports were always the same each day. When I asked what they did for processing each day, she said: [LIST] [*]Make backup of database. [*]Enter all the daily records. [*]Restore database from backup. [*]Run … | |
Re: To change the default icon of your .exe file click on : [LIST=1] [*]Project [*][Project Name] Properties [*]Application [*]Icon [*](From the Combobox select) <Browse…> [/LIST] | |
Re: [code]char myChar = 'c'; String myString = myChar.ToString();[/code] | |
Re: Get rid of the '"' in your connection strings. There are two in each. | |
Re: There is no limit on the number of connections you can accept on a socket (baring memory limitations). I'm not sure what you are trying to accomplish. Do you want to limit the number of connections? | |
Re: Go to the ODBC Data Source Administrator. Select the System DNS tab. Click Add Select SQL Server. Click Finish. Fill in form values for your server. Done. | |
Re: To test the speed of foreach vs LINQ I created ten million GUID then randomly picked one to search for. The two methods tested where: [code]foreach (String s in myList) { if (s.Equals(toFind)) { found = s; break; } } var found = myList.Find(n => n.Equals(toFind));[/code] There was no difference … | |
Re: [URL="http://www.rhi.com/"]Robert Half[/URL] pays weekly, as does [URL="http://www.adecco.com/Pages/default.aspx"]Adecco[/URL]. You get about 50% of what they charge | |
Re: In the file program.cs you'll find the line [icode]Application.Run(new Form1()); [/icode]. Change the Form1 to Form2. | |
Re: From line 41 of form1.cs :[code]if (progressBar1.Value == 100) { Form1 f = new Form1(); f.Hide(); Form2 f1 = new Form2(); f1.Show(); }[/code] Why are you creating another form1? Did his sample code show him creating another form1? No, so don't do it. [code]if (progressBar1.Value == 100) { this.Hide(); // … | |
Re: It's a lot easier than that: [code]int a = 1; sourceType b = (sourceType)a;[/code] Any int can be cast into any enum. If it is valid, ToString() will show the text of the enum, otherwise you'll get the number. For example: [code]int a = 1; sourceType b = (sourceType)a; Console.WriteLine(b.ToString()); … | |
Re: You'll have to make heavy use of reflection and make sure you get the attributes (XmlAttribute, XmlElement, XmlRoot, XmlIgnore, etc.) and execute the appropriate methods (OnDeserializing, OnDeserialized, OnSerializing, OnSerialized). You'll need to determine what order your serializer will place attributes (alphabetical, as coded order, as specified by attributes) and if … | |
Re: No, it's not the greatest method ever. The Newton-Raphson method is faster and you have a lot of inefficient code in there. Doing one square root shouldn't take enough time to be measurable on any computer made after 1990. If you can actually get a real time measurement, you are … | |
Re: Yes, use the convert() function like in [URL="http://www.daniweb.com/forums/thread350476.html"]this[/URL] post. | |
Re: Well, if you take a look at the method UpdateMenu you find [icode]public void UpdateMenu(GameTime gameTime)[/icode]. Your call to it doesn't pass a gameTime object, thus the error. The rest of your errors are similar in nature. When a method needs an object, you have to pass that object to … | |
Re: Some psuedo code to help you along [code]Get amount from user while amount > 0 for (int i = 0; i < length of coin value array; i++) coinamount[i] = amout / coinvalue[i]; amount = amount % coinvalue[i]; end if Display the values in cointamount array Get new amount from … | |
Re: SELECT a.Term, b.Term From Term a, Term b, TermHMRelatedTerm c WHERE a.ID = c.TermID and b.ID = c.RelatedTermID Just FYI, there is no Gamma->Beta (there is Beta->Gamma) and your output is missing Charlie->Beta (in your 'what I want' data). | |
Re: Find Find/Replace Font Font size Font attributes (Bold, Italic, underline) Font color Cut Paste Copy Indent Align left Align right Align center Pick one of these, implement it, pick another. Keep going until you've done them all or your two months are up. Do one at a time and once … | |
Re: Think you might give a hint to which lines have errors? | |
Re: You'll need four select statements and some if/else statements. I'd make sure the -- ALL -- always had an index of 0 for ease of use. | |
Re: The 101 refers to the output format for the date conversion. You can see all the style values [URL="http://msdn.microsoft.com/en-us/library/ms187928.aspx"]here[/URL] | |
Re: You create a dataset then try to retrieve a table from it, but you haven't loaded anything into the dataset. You then try to get a row from the non-existent table, then data from the non-existent row. You should read [URL="http://msdn.microsoft.com/en-us/library/ms171920%28v=vs.80%29.aspx"]this[/URL]. | |
Re: Does the table your are trying to fill exist? Do all the column name/types match? What error are you getting? | |
Re: I don't see anywhere in your code that you set the image property of the picturebox control. Is there code missing? | |
Re: You don't say how you are connecting to the MySQL database. Are you using OleDB or one of the many MySql to .Net libraries? Have you tried a different method? Post your DB code (probably the C# forum would be a better place) and maybe we can point out something … | |
Re: Since they are strings, 9 comes after 1. You'll have to convert them to numbers if you want numerical sort order ([icode]cast(substring(st_no,3,4) AS INT)[/icode]), assuming they are all numbers. Since they also have string part, you'll have to split them into two fields ordering first on the text, then on … | |
Re: select type, sum(price), avg(discount) from interiors where name = 'baby cot' group by name Not tested, YMMV. | |
| |
Re: [code]public String[] GetWordsFromFile(String filename) { List<String> myWords = new List<String>(); if (File.Exists(filename)) { String[] myStrings = File.ReadAllLines(filename); foreach (String line in myStrings) { String[] words = line.Split(new char[] {' ', '\n', '\r', '\t'}, StringSplitOptions.RemoveEmptyEntries); foreach (String word in words) { myWords.Add(word); } } } return myWords.ToArray(); }[/code] | |
Re: This method will allow you to italicize between any two characters. You can even specify a starting point if you want (works for .Net 4.0, otherwise remove the '= 0' default specifier and it will work under anything, but you'll have to provide all three parameters). [code]private void Italics(RichTextBox r, … | |
Re: Take a look at [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.aspx"]CheckBox[/URL] | |
Re: You need to change the "\n" to "\r\n". | |
Re: There is no code that you have given that adds days 30 or 31 (just 29 for leapyear). Why do you expect it to add days? | |
Re: [code]int[] StringToInt(String[] input) { int[] output = new int[input.Length]; for (int i = 0; i < input.Length; i++) { output[i] = Int32.Parse(input[i]); } return output; }[/code] There is no error checking in this code. Passing a null array or anything in the string array that isn't an integer will throw … | |
Re: The thread is dead, the user was banned. Let it go, man. | |
Re: I think the major issue you'll have is that the hover event only occurs one time. It won't fire again until you move the mouse off the control and back on. Given that, I created a simple form with a trackbar, a label and a timer. Below is the code … | |
When Microsoft was developing Windows Vista (and they continued this in Windows 7) they decided to add a security feature to the Program Files directories. This feature is that all the directories are read only. The idea behind this is to prevent malicious software from overwriting your exe/dll files. This, … | |
Re: Just FYI, having [code]using (Type variable = something that implements IDisposable) { // code here }[/code] Is translated by the compiler into[code]Type variable = something that implements IDisposable; try { // code here } finally { if (variable.Disposed == false) { variable.Dispose(); } }[/code] | |
Re: Line 62: OleDB doesn't allow named paramters. Replace '@photo' with a question mark '?'. | |
Re: It's a requirement of the language itself that base classes must be at least as accessable as classes derived from them. This means if you wish a public child class, the parent class must be public also. You can write a class that contains your base class (has an instance … | |
Re: You need to set the update command in the DataAdapter: [code]... Dim mCB A New OleDb.OleDbCommandBuilder(mDA); mDA.UpdateCommand = mCB.GetUpdateCommand(); mDA.Update(mDS, "temp_data");[/code] | |
Re: Line 47 of your sort code should be [icode]numbers(x) = numbers(x + 1)[/icode] and line 49 should be [icode]numbers(x + 1) = temp[/icode] |
The End.