4,439 Posted Topics

Member Avatar for darab

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.

Member Avatar for kvprajapati
0
113
Member Avatar for aulason

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 …

Member Avatar for ddanbe
0
215
Member Avatar for MJV

YYYY*10000 + MM*100 + YYYY % 100 should do the tric. YYYY being DateTimePicker.Value.year and MM being DateTimePicker.Value.month of course.

Member Avatar for serkan sendur
0
3K
Member Avatar for NargalaX
Member Avatar for serkan sendur
0
299
Member Avatar for nkarvi

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)

Member Avatar for nkarvi
0
92
Member Avatar for 666kennedy

Use the TimeSpan class and the overloaded + operator. [CODE=c#]TimeSpan FifteenSecs = new TimeSpan(0, 0, 15); time = time + FifteenSecs;[/CODE]

Member Avatar for ema005
0
191
Member Avatar for Ancient Dragon
Member Avatar for GrimJack
0
298
Member Avatar for qauaan

Perhaps cropping your image might help [url]http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.croppedbitmap.aspx[/url]

Member Avatar for ddanbe
0
85
Member Avatar for si01

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?

Member Avatar for si01
1
153
Member Avatar for shinegun

Why not search this site for answers? Searched for "Pass items between forms" I got [url]http://www.daniweb.com/forums/thread12443.html[/url]

Member Avatar for shinegun
0
74
Member Avatar for MV89

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 …

Member Avatar for MV89
0
121
Member Avatar for barker1889

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 …

Member Avatar for ddanbe
0
187
Member Avatar for Kracus

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.

Member Avatar for jeremy.adamich
0
116
Member Avatar for kevin.cochrane
Member Avatar for 666kennedy

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.

Member Avatar for ddanbe
0
380
Member Avatar for darqer

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.

Member Avatar for darqer
0
113
Member Avatar for bodikon

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]

Member Avatar for Diamonddrake
0
353
Member Avatar for john_beginner

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

Member Avatar for papanyquiL
-1
80
Member Avatar for ddanbe

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 …

Member Avatar for sknake
0
78
Member Avatar for cmrhema

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 …

Member Avatar for ddanbe
0
370
Member Avatar for NargalaX

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?

Member Avatar for ddanbe
0
155
Member Avatar for gavin1234

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.

Member Avatar for ddanbe
0
79
Member Avatar for Lakshith

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 …

Member Avatar for kvprajapati
0
105
Member Avatar for ddanbe

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

Member Avatar for sknake
0
329
Member Avatar for Dajer

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]

Member Avatar for sknake
0
193
Member Avatar for selvaganapathy

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]

Member Avatar for ddanbe
0
568
Member Avatar for valter

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.

Member Avatar for ddanbe
0
110
Member Avatar for aulason

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.

Member Avatar for ddanbe
0
99
Member Avatar for k.d.m

Perhaps [url=http://www.codeproject.com/KB/dotnet/NET_Printer_Library.aspx]this[/url] may provide some info?

Member Avatar for ddanbe
0
93
Member Avatar for jaaam

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]

Member Avatar for k.d.m
0
167
Member Avatar for aulason

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 …

Member Avatar for aulason
0
89
Member Avatar for ddanbe

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 …

Member Avatar for ddanbe
0
125
Member Avatar for john_beginner

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 …

Member Avatar for madz_feat
0
122
Member Avatar for swinefish

Perhaps [url=http://www.daniweb.com/code/snippet1009.html]this snippet[/url] is something for you.

Member Avatar for swinefish
0
288
Member Avatar for papanyquiL

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

Member Avatar for ddanbe
0
134
Member Avatar for echo off

In C# it is called [B]switch (...) case ...[/B] not [B]select (...) case ...[/B] Hope this helps a bit.

Member Avatar for echo off
0
181
Member Avatar for john_beginner

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?

Member Avatar for john_beginner
0
968
Member Avatar for Mortez Maya

I tried : [B]string p = Application.StartupPath;[/B] The string p contains the correct startuppath.

Member Avatar for Mortez Maya
0
761
Member Avatar for wingers1290

If I do this it works fine with me: [B]label1.Text = "12345";[/B] Perhaps your [B]variable [/B]is empty?

Member Avatar for wingers1290
0
142
Member Avatar for laghaterohan

Use a DataGridView instead of a GridView. Editing should be straightforward, click a cell and start to type.

Member Avatar for laghaterohan
0
133
Member Avatar for ddanbe

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 …

Member Avatar for kvprajapati
0
113
Member Avatar for Nogat21

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.

Member Avatar for sknake
0
445
Member Avatar for suhasinishinde
Member Avatar for jayneben

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 …

Member Avatar for ddanbe
0
310
Member Avatar for FTProtocol

Yes I have a clue. I smell some Mexican, Pig whatever flu around here:( :'(

Member Avatar for sknake
0
248
Member Avatar for wingers1290

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.

Member Avatar for ddanbe
0
283
Member Avatar for db11

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 …

Member Avatar for db11
0
175
Member Avatar for Acidburn

Maybe [url=http://www.vsj.co.uk/articles/display.asp?id=600]this website[/url] is a good starting point.

Member Avatar for ddanbe
0
117
Member Avatar for nverma

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.

Member Avatar for kvprajapati
0
113
Member Avatar for S2009

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

Member Avatar for kamisori
0
120

The End.