889 Posted Topics
Re: [URL="http://msdn.microsoft.com/en-us/library/system.math.aspx"]Here[/URL] is a link to the MSDN docs for the System.Math class. Take a look and see if there is any method in there that can help. | |
Re: Australian Rules Football. See [URL="http://www.afl.com.au/"]the AFL website[/URL] for details of this amazing sport. | |
Re: This statement is a LINQ statement which selects all members of the list (or enumerable) named patchFiles which meet the condition of the method TryReadPatch (I don't know this method sorry) into an array named allPatches. I'm not sure if C++ makes use of LINQ, try a google search to … | |
Re: You will need a pretty good understanding of how to use I/O in java to do this assignment. Take a look at the java API in the java.io package and I'm sure there are some tutorials on the sun website about I/O. The rest of the program is just a … | |
Re: Also, you should use the static [icode]String.IsNullOrEmpty[/icode] method to check for uninitialised strings. | |
Re: Not sure if this will help you, but you can use LIKE when trying to match strings in SQL. To take your example: [code=mssql] select * from Customer where FirstName LIKE 'Jim%' AND LastName LIKE '%Sau%' [/code] This will select all customers whose first names start with Jim and last … | |
Re: Yes you are correct, however string is a bit of a special case in the way that it is initialised. A better description of objects is to look at your post in your other thread where you had: [code] Human human = new Human(); [/code] In this example, you are … | |
Re: Your call to create your new Human object is calling the constructor method for the Human class, it is not itself a constructor. Calling the constructor of a class is the only way of creating a new instance of your class. You can have a different method that returns a … | |
Re: Your call to Message.Show is wrong, you need to add String.Format like so: [code] MessageBox.Show(String.Format("{0}",hello2(2))); [/code] Also, it doesn't matter what number gets passed as the parameter to your hello2 function, it will always show 10 / 5. A better implementation would be: [code] private void button1_Click(object sender, EventArgs e) … | |
Re: The following if-statement is equivalent to your switch statement. You can see from this code that Narue is correct: [code] if (fillnumb == 0) fillnumb = 1; else if (fillnumb == 1) fillnumb = 2; [/code] | |
Re: I see two potential issues with your code: [code] // first call to ReadLine() advances the stream foreach (string record in reader.ReadLine().Split('|')) { // first time will read the second line because of first call while ((line = reader.ReadLine()) != null) { if (Regex.IsMatch(line, searchText, RegexOptions.IgnoreCase)) { // the text … | |
Re: Without further information about the application you are building, the only minimum requirement is the .NET Framework 4.0. It can be downloaded freely from the MSDN website. | |
Re: The String method compareToIgnoreCase should do the trick. For example: [code=java] int result = string1.compareToIgnoreCase(string2); // here result < 0 if string1 > string2 // or result = 0 if string1 == string2 // or result > 0 if string1 < string2 [/code] That should give you a start anyway. … | |
Re: In your form add a property like so: [code] public decimal Answer { get { return Convert.ToDecimal(AnswerBox.Text); } set { AnswerBox.Text = value.ToString(); } } [/code] Then in your other class add a reference to the form and set the Answer property accordingly. [code] class Calculator { private MyForm form; … | |
Re: Check out the [URL="http://msdn.microsoft.com/en-us/sync/default.aspx"]Microsoft Sync Framework.[/URL] It's a bit of work to set up in your application but once up and running it works a treat. | |
Re: You need to join to the tblRespondentsChildren table twice, once for each child. Something like this should give you a start: [code] SELECT r.FirstName, r.Surname FROM tblRespondents r INNER JOIN tblRespondentsChildren rc1 ON r.RespondentID = rc1.RespondentID INNER JOIN tblRespondentsChildren rc2 ON r.RespondentID = rc2.RespondentID WHERE rc1.DOB BETWEEN ('1998-09-01') AND ('1999-08-31') … | |
Re: There are a few things that could be better with your code, but your syntax error is caused by this: [code] i_EmpPayGrade) (s_String, i_Integer) [/code] which I believe should be this: [code] i_EmpPayGrade, s_String, i_Integer) [/code] You should really use a parameterised query to pass all of those variables to … | |
Re: From the MSDN documentation on [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox%28v=VS.90%29.aspx"]PictureBox[/URL]: [code] // Stretches the image to fit the pictureBox. pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; MyImage = new Bitmap(fileToDisplay); pictureBox1.ClientSize = new Size(xSize, ySize); pictureBox1.Image = (Image) MyImage; [/code] You can substitute pictureBox1 in the above example for choices[0] in your code. fileToDisplay is the string filepath. … | |
Hi all, Well this is my 1000th post here at DaniWeb and I thought "What better way to celebrate than by posting my first ever code snippet?" This problem occurred in an application that I am working on. I have a password field in my form that was specified as … | |
Re: In MySQL, you need to enter a date in the format "YYYY-MM-DD", so with your three variables you can make the date string in that format using the date and mktime functions. Something like this should work: [code=php] // date needs format and timestamp // mktime needs hours, minutes, seconds, … | |
Re: Try this: [code] protected readonly int ID = ID.GetNextID(); [/code] | |
Re: Your first dialog is close but should make use of the overriden method for MessageBox.Show like so: [code] DialogResult r = MessageBox.Show("Do you want to save changes?", "Save Changes?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); [/code] Then you can check the variable r to see which button the user pressed and take the appropriate … | |
Re: I prefer your method personally. I go one step further and put enums in their own file with an extension of the TypeConverter class to perform casts between an enum and a string. | |
Re: [QUOTE]I'm trying to open a file from a folder called "Assginement" however, when the program get's released, it might not be in a folder called this. What could I do? I've tried everything. [/QUOTE] If it is in the folder where the application is running from, use [ICODE]Directory.GetCurrentDirectory()[/ICODE] static method. … | |
Re: Change the parameters line to: [code] command.Parameters.AddWithValue("@user", selectuser); [/code] @user is the parameter, username is the column. | |
Re: I find that setPreferredSize tends to work more often than setSize although as jwentig has mentioned it is not guaranteed. A subsequent call to pack(), validate() or invalidate() often overrides any previous call to setting the size anyway. | |
I have noticed a small discrepancy between my Avatar in posts and my profile page. On the left you will notice that I have 995 posts to my name, but my profile screen says 997. I am unsure what the correct number should be. Normally I wouldn't worry about such … | |
Re: This is a relatively simple task in C#. Copying files from one place to another can be done using either of the [URL="http://msdn.microsoft.com/en-us/library/bc33648k.aspx"]File.Copy[/URL] methods depending on your needs. Reading and writing from the database in C# is also straight forward. There are many tutorials out there, Google should provide many … | |
Re: I would probably agree with that, but why do you think that implementations change more often than interfaces? | |
Re: In what context are you attempting to use "\t"? Can you post your code? | |
Re: Check out the [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox%28v=VS.90%29.aspx"]MaskedTextBox[/URL] class. This is a text box that all data entry must follow a specific mask (format). | |
Re: Hi Ceerno, Sorry to say but there are a number of problems with your code. The first thing I noticed was that your for-loops run from index 1 up to and including the Array length. Arrays are indexed from 0, so it should run from 0 to (but not including) … | |
Re: I think you are talking about the TextBox.ContextMenuStrip property? You can simply create a ContextMenuStrip (in Designer or in Code) and assign it to this property. If the property is not set, there is no ContextMenuStrip for the TextBox, that is there is no "inbuilt" ContextMenuStrip. Example: [code] ContextMenuStrip cms … | |
Re: Hi haripriyamca05 and welcome to DaniWeb :) Please note that there is an [URL="http://www.daniweb.com/forums/forum18.html"]ASP.NET[/URL] forum here at DaniWeb where you can ask ASP.NET questions. That said, all you need to do in your popup form is listen to the form Closing event, and read the TextBox.Text properties for each text … | |
Re: Hi TheDocterd, This looks like Visual Basic code. It might pay to ask your question in the [URL="http://www.daniweb.com/forums/forum4.html"]Visual Basic 4 / 5/ 6[/URL] forum where someone who knows VB can help you. Also, please use code tags when posting snippets of your code for readability. Good luck and happy programming … | |
Re: If you mean a barcode scanner, then each scanner will have its own communication protocol that you can talk to via serial port connection or some other means. You will need to read up on the technical specifications for the model you want to use. Often manufacturer's websites will have … | |
Re: You need to handle incoming connections on one thread, then handle each connection on an individual thread. [URL="http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server"]This tutorial[/URL] is a really good starting point for a TCP client-server model. | |
Re: You can set the date format for your server using the [URL="http://msdn.microsoft.com/en-us/library/ms189491.aspx"]SET DATEFORMAT[/URL] function, but this will set the format for all dates in your system. I think the best way to go for you is to store the full date in the database (or even just 1-Aug-10 for all … | |
Re: Hi AndreiZ3 and welcome to DaniWeb :) You need to cast the tag back to a datarow, then you can access each part by their names, using the methods in the Convert class to convert to the datatype required. For example, [code] ListViewItem lvi = lvProductsOrdered.Items[lvProductsOrdered.SelectedIndices[0]]; if (lvi.Tag.GetType() == typeof(DataRow)) … | |
Re: You can use the [URL="http://msdn.microsoft.com/en-us/library/fk49wtc1%28v=VS.90%29.aspx"]String.Replace[/URL] method for this purpose. What I would do is replace the string [var hello = ""] with your new string. Let's say you have read the file contents into a string called contents. Here is basically how you would do it: [code] public string SpecifyHello(string … | |
Re: Hi svatstika and welcome to DaniWeb :) The easiest way to do this is to provide a reference to the input in your forms like so: [code] public partial class Form1: Form { // create a property to store the input from the user public string UserInput { get; set; … | |
Re: There are lots of good tutorials out there, google will provide many. As for your elapsed time question, there are a number of ways to do this but here is the way I like to handle it: [code] // remember the time at the start DateTime start = DateTime.Now; // … | |
Re: [URL="http://msdn.microsoft.com/en-us/library/dd383458.aspx"]Directory.EnumerateFiles[/URL] is one of many ways to do this. | |
Re: Test Driven Development is a methodology where you write test cases before you write the actual code, then write code to pass the tests and no more. For example, say we were writing a class to describe a square and we want a method that gives us the perimeter of … | |
Re: The problem here is that the @DatabaseName in the command is not an SQL datatype field. You instead need to build your query like so: [code] public void CreateDatabase(string databaseName) { string query = String.Format("CREATE DATABASE {0}", databaseName); // now execute the query using DbCommand or similar class... } [/code] | |
Re: Here is how you assign an event handler programatically (my example assigns an event handler to the Button.Click event): [code] public void SetupButton() { Button myButton = new Button(); // assign the event handler myButton.Click += new EventHandler(myButton_click); } // definition for the event handler code // note that the … | |
Re: You can use class properties to do this. A simple example: [code] public class MyClass { public string MyProperty { get; set; } } [/code] [code] public partial class MyForm: Form { private MyClass myObject; public MyForm() { InitializeComponents(); myObject = new MyClass(); } public void PassString(string str) { myObject.MyProperty … | |
Re: You need to quote your string N like so: [code] WHERE p.DATE IS NULL and p.TRUE = 'N' [/code] | |
Re: We aren't allowed to just give you the code (what would that achieve?) Please show us your attempt and ask any specific questions for any problem that you may be having and we will be happy to point you in the right direction. | |
Re: You need to iterate over your array and write out each one individually. You can do this using a while, for or foreach loop. Have you been shown how to use any of these loops? |
The End.