4,439 Posted Topics
Re: I believe a maskedTextBox is a bit of an old fashioned kind of UI style of programming. Use Validate and Validating events if you want to check the input in a TextBox or use a DateTimePicker for a date. | |
Re: Most of the time you do not want to provide a seed to a random number generator. This will have the same effect as your code: [B]Random rndCell = new Random();[/B] Line 5 and 6 can be replaced with this : [B]int rndIndex = rndCell.Next(aCells.Length-1);[/B] If your array has a … | |
Re: YYYY*10000 + MM*100 + YYYY % 100 should do the tric. YYYY being DateTimePicker.Value.year and MM being DateTimePicker.Value.month of course. | |
Re: Would the label on the form be capable of dragging itself? | |
Re: You are in fact indexing the DataGridView by using that syntax. In your case it says: Show the string of the Value in column a and row b. (column and row indexes are zero based, so column 0 would be the first column) | |
Re: Use the TimeSpan class and the overloaded + operator. [CODE=c#]TimeSpan FifteenSecs = new TimeSpan(0, 0, 15); time = time + FifteenSecs;[/CODE] | |
Re: Perhaps cropping your image might help [url]http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.croppedbitmap.aspx[/url] | |
Re: Please try to use code tags when you post code! Have you included all the necessary references in your project? Could you point out the lines in your code where you first encounter a problem or are this compile errors? | |
Re: Why not search this site for answers? Searched for "Pass items between forms" I got [url]http://www.daniweb.com/forums/thread12443.html[/url] | |
Re: Please use code tags! When it is only one line of code I usually post them in bold. Form your second code listing(just changed one value): [B]int data[] = { 0, 100, 2, 3, 4, 5, 3, 7 }; /* initialise the data array */ [/B] What would happen if … | |
Re: In the solutions explorer right click the project choose [B]Add item... [/B]in the window that opens choose [B]Class[/B]. In there you can put all the code of your class. Now suppose I made a Traingle class I could fill in the Piant event handler of the form with something like … | |
Re: Hi Kracus, welcome on DANIWEB! Please, if you post code use code tags! I think we need a bit more code to see what is actually wrong. | |
Re: Is the excel sheet also slow after you close and reopen it? | |
Re: You could use the method SubString here like [B]Mystr.SubString(charpos,lenghttoextract);[/B] You can let this work like left,mid,right if you want. | |
Re: The stuff about the debugger, I don't understand. If you want to make a winforms application download Visual Studio C# Express. It is free. | |
Re: You could use a UserControl. Or you could derive from an existing button class like I did in [url=http://www.daniweb.com/code/snippet1171.html]this code snippet[/url] | |
Re: Please stop posting me PMs I can't understand.:@ Please post in decent English. :angry: It doesn't have to be perfect.:) What I can make out of what I think is some sort of SMS gibberish is that you want to use something like [url=http://msdn.microsoft.com/en-us/library/ms173183(VS.100).aspx]this[/url] I think... | |
First I thought it had something to do with that new "automatic properties" feature of C#, but when I used the normal scheme for properties I got the same error message : [COLOR="Red"]Cannot modify the return value of 'AxisTest.Form1.Axis.XOrg' because it is not a variable [/COLOR] Wonder what is wrong … | |
Re: I hope this snippet does what you want : [CODE=csharp]using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { double d1 = 1000.23; double d2 = 1000.26; Console.WriteLine("d1= {0:F}", roundNum(d1,2)); Console.WriteLine("d2= {0:F}", roundNum(d2,2)); Console.ReadKey(); } public static double roundNum(double num, int place) { double d = num … | |
Re: Please use code tags when you send code! GUI must normally be of type Form. [B]thismodulefilenamestr [/B]is initialised but never used. Could you post us your whole project in a zip file? | |
Re: I'm not expert, but I think [url=http://msdn.microsoft.com/en-us/library/system.net.sockets.networkstream.read.aspx]this[/url] should explain it. | |
Re: Hello Lakshith you are most welcome on DANIWEB! Of course there is a method! You've just wrtten it. Two remarks: ***> " " is text, it is a string containing one char: the space. Use "" or string.Empty here. ***> because you test for two opposite things you don't have … | |
I'm working on a Complex number struct. To display the numbers I've overridden the ToString method like this: [CODE=c#]public override string ToString() { if (_imag >= 0) return String.Format("({0}+{1}i)", _real, _imag); else //imaginary part negative return String.Format("({0}{1}i)", _real, _imag); }[/CODE] Works fine. My numbers get displayed as (a+bi) or (a-bi). … | |
Re: A very good code snippet that explains how to exchange data between forms is this one [url]http://www.daniweb.com/code/snippet1008.html[/url] | |
Re: On [url=http://msdn.microsoft.com/en-us/library/system.diagnostics.process.startinfo(VS.85).aspx]this msdn page[/url] I read: [I]If you call the Start(ProcessStartInfo) method with the ProcessStartInfo.UserName and ProcessStartInfo.Password properties set, the unmanaged CreateProcessWithLogonW function is called, which starts the process in a new window even if the CreateNoWindow property value is true or the WindowStyle property value is Hidden.[/I] | |
Re: Please use code tags if you post code. I think [B]foreach (Control Ctl in MainForm.Controls)[/B] should read [B]foreach (Control Ctl in Frm1.Controls)[/B], also CmbRecords should resolve to a string. | |
Re: Did you try to search this site? I think it contains already all you need to know:) I searched for [B]add labels at runtime[/B] The first thread I found was : [url]http://www.daniweb.com/forums/thread200667.html[/url] If you can't figure it out, please come back here with your questions. | |
Re: Perhaps [url=http://www.codeproject.com/KB/dotnet/NET_Printer_Library.aspx]this[/url] may provide some info? | |
Re: Perhaps you could read some suggestions of the book you suggested on [url=http://www.amazon.com/Head-First-C-Andrew-Stellman/dp/0596514824/ref=sr_1_1?ie=UTF8&qid=1249077149&sr=8-1]this webpage [/url] I would not buy it, I'd rather buy [url=http://www.amazon.com/Microsoft-Visual-C-2008-Step/dp/0735624305/ref=sr_1_3?ie=UTF8&qid=1249077149&sr=8-3]this one [/url] | |
Re: A form has a ControlsCollection which is called Controls. You can loop through that with a foreach. Something like this: [CODE=c#]// look through the controls of the form foreach (Control c in this.Controls) { if (c is Label) //see if it is a Label control { // now do something … | |
In C# a struct is a bit like a class, but most of the time used for little items you might have. A struct is also a value type, while a class is a reference type. Now .NET is poorly equipped with math features. As I wanted to play around … | |
Re: Ciao, john_beginner! Line 62 should read: [B]TextBox1.Text = ans.ToString();[/B] ToString is a method, all methods have at least (), else it is a field or a property. Also in the future don't say you have an error, but give a description of the error message you recieve. That's always more … | |
Re: Perhaps [url=http://www.daniweb.com/code/snippet1009.html]this snippet[/url] is something for you. | |
Re: It is not a good UI idea to let a user select something from a dialog and then let him click the Cancel button. Use the OK button instead. Line 8 opens the dialog again, you opened it already in line 6. So remove line 6. Line 8 should read: … | |
Re: In C# it is called [B]switch (...) case ...[/B] not [B]select (...) case ...[/B] Hope this helps a bit. | |
Re: What do you mean with control array? An array of controls? Or something like a TableLayoutPanel? Perhaps you could show us some code of what you relly mean? | |
Re: I tried : [B]string p = Application.StartupPath;[/B] The string p contains the correct startuppath. | |
Re: If I do this it works fine with me: [B]label1.Text = "12345";[/B] Perhaps your [B]variable [/B]is empty? | |
Re: Use a DataGridView instead of a GridView. Editing should be straightforward, click a cell and start to type. | |
Look at this thread: [url]http://www.daniweb.com/forums/thread206859.html[/url] In C# this would give: [CODE=C#]namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int i = 0; i = i++; Console.WriteLine(i); Console.ReadKey(); } } }[/CODE] Also in C# it prints 0. I wonder why. I think Java is correct here. Although it … | |
Re: Welcome Nogat21! First : post your code in code tags, info is available on this site. Second : I think you are having problems with the checed listbox class. It does not always behave as you think. I don't use it any more. | |
Re: Do you mean that the text in your buttons has to be left aligned? | |
Re: I would do it this way : [CODE=c#]namespace ConsoleApplication1 { class Program { static List<int> intlist = new List<int>(); //make a list static void Main(string[] args) { intlist.Add(5); //fill the list with 5 ints intlist.Add(3); intlist.Add(5); intlist.Add(15); intlist.Add(7); intlist.Sort(); //sort and reverse intlist.Reverse(); foreach (int i in intlist) //print on … | |
Re: Yes I have a clue. I smell some Mexican, Pig whatever flu around here:( :'( | |
Re: Just as the panel1.Controls (wich is of type Control.ControlsCollection) has an [B]Add [/B]method, it may not be to suprising to notice, it also has a [B]Remove [/B]method. | |
Re: Some remarks : >Your coding style seems rather chaotic, to say the least. >Why do you test if you want to continue with your function INSIDE the function? Never call a function if it is not needed. Your [B]alreadydone [/B]variable should be used outside the function. Btw. the for loop … | |
Re: Maybe [url=http://www.vsj.co.uk/articles/display.asp?id=600]this website[/url] is a good starting point. | |
Re: Welcome nverma. What do you mean by saving a file in a database? Show us the code you already have. And if you do so PLEASE use code tags. | |
Re: All the above is quite OK. Just a remark: when I disable my menu items, I consider my users smart enough to figure out by themselves, they don't have the authorty, or to guess that the program is in a state where it is meaningless to use this menu option. … |
The End.