Click here to Skip to main content
14,975,411 members
Everything / Desktop Programming / Windows Forms

Windows Forms

WinForms

Great Reads

by Josh Smith
A task-oriented review of an animation library and the application which uses it
by Nish Nishant
This articles explains how to implement a TypeDescriptionProvider for a class to support multiple object types using a single class type
by Marc Clifton
Review your project dependencies.
by Nish Nishant
An ExifReader class in C# that supports custom formatting and extraction. StyleCop compliant code, with demos for WPF and Windows Forms.

Latest Articles

by Joe Dufresne
An easy to use tool to save your Windows Spotlight (lock screen) images for use as desktop wallpaper
by Leif Simon Goodwin
A 3D surface plot control in C#
by GuyThiebaut
Detecting an available update and installing the update via an online download - an alternative to ClickOnce
by Tomaž Štih
A tree drawing algorithm, implemented as C#/WinForms/NET Core control, that produces surprisingly good results with minimal effort

All Articles

Sort by Score

Windows Forms 

Please Sign up or sign in to vote.
9 May 2012
Josh Smith
A task-oriented review of an animation library and the application which uses it
Please Sign up or sign in to vote.
16 Jun 2008
Nish Nishant
This articles explains how to implement a TypeDescriptionProvider for a class to support multiple object types using a single class type
Please Sign up or sign in to vote.
17 Jun 2009
Marc Clifton
Review your project dependencies.
Please Sign up or sign in to vote.
29 Mar 2010
Nish Nishant
An ExifReader class in C# that supports custom formatting and extraction. StyleCop compliant code, with demos for WPF and Windows Forms.
Please Sign up or sign in to vote.
2 Dec 2011
Florian Rappl
A better ToolTip for Windows Forms and more.
Please Sign up or sign in to vote.
18 Apr 2010
Nicholas Butler
A tiny HTTP server wrapped in a WebBrowser control
Please Sign up or sign in to vote.
6 Aug 2009
Marcelo Ricardo de Oliveira
Demo for a math puzzle board game
Please Sign up or sign in to vote.
31 Jan 2010
Arik Poznanski
Complete Library for using the Windows 7 Ribbon from C#, including 18 samples and 21 blog posts documenting the Ribbon features
Please Sign up or sign in to vote.
11 Sep 2011
Anshul Mehra
This article provide APIs & functionality so that Excel Quits after automation
Please Sign up or sign in to vote.
4 Jul 2014
Chakravarthi Elchuri
How to use WIA supported scanner using C#
Please Sign up or sign in to vote.
28 Nov 2011
Akos Orban
Set Owner of a WPF Window to a Form
Please Sign up or sign in to vote.
22 Dec 2016
Ozesh Thapa
Converting Docx To Html to Docx
Please Sign up or sign in to vote.
10 May 2009
DaveyM69
Allows changing of the default MIDI out device in Vista and Windows 7
Please Sign up or sign in to vote.
11 Sep 2009
yetibrain
A listview running in virtual mode
Please Sign up or sign in to vote.
15 Mar 2010
Arik Poznanski
In this article, I'll present how to use the ribbon drop down color picker control.
Please Sign up or sign in to vote.
23 Mar 2010
Arik Poznanski
In this article, I'll present how to work with the ribbon quick access toolbar.
Please Sign up or sign in to vote.
5 Aug 2009
Cosmin Oprea (aka somalezu)
This article describes a very simple way to make WinForms databindings without the need to refer the datasource property names with magic strings.
Please Sign up or sign in to vote.
10 Sep 2009
ralph1957
This step-by step article describes how to populate a TreeView control by using XML data.
Please Sign up or sign in to vote.
9 Mar 2010
Arik Poznanski
In this article, I'll present how to use the ribbon combo box control.
Please Sign up or sign in to vote.
6 Mar 2010
Arik Poznanski
In this article, I'll present how to use the ribbon application menu with ribbon split button and ribbon drop button controls.
Please Sign up or sign in to vote.
22 Mar 2010
Arik Poznanski
In this article, I'll present how to work with ribbon context popup.
Please Sign up or sign in to vote.
2 Nov 2010
Nish Nishant
Looks like you are looking for an auto-complete textbox. If so, see:http://www.codeproject.com/KB/cs/AutoCompleteTextBox.aspx[^]It's written in C#, but you can use that from VB.NET.
Please Sign up or sign in to vote.
17 Nov 2011
Timur Eroglu
List and extract .NET resources
Please Sign up or sign in to vote.
31 Oct 2016
phil.o
This article describes the building of Markov Chains and their use for generating random names or words.
Please Sign up or sign in to vote.
23 Dec 2018
charles922
Introduction to Orbital Mechanics - 2 Body Problem
Please Sign up or sign in to vote.
21 Apr 2009
Fredrik Bornander
How to implement an iPhone style icon menu using the .NET Compact Framework.
Please Sign up or sign in to vote.
19 Mar 2010
Arik Poznanski
In this article, I'll present how to load ribbon resources from external DLLs.
Please Sign up or sign in to vote.
20 Mar 2010
Arik Poznanski
In this article, I'll present how to work with ribbon application modes.
Please Sign up or sign in to vote.
7 Mar 2010
Arik Poznanski
In this article, I'll present how to use ribbon tabs, groups and the ribbon help button control.
Please Sign up or sign in to vote.
17 Jan 2019
Ramon F. Mendes
A lightweight HTML control for WinForms
Please Sign up or sign in to vote.
14 May 2009
CS Rocks
This article demonstrates how to upload a file to a (HTTPS) WebDAV server in VB.NET.
Please Sign up or sign in to vote.
14 Feb 2010
Irfan alam
A library for creating a voice and text conferencing application
Please Sign up or sign in to vote.
12 Mar 2010
Arik Poznanski
In this article, I'll present how to work with images in the ribbon.
Please Sign up or sign in to vote.
14 Mar 2010
Arik Poznanski
In this article, I'll present how to use the ribbon check box and toggle button controls.
Please Sign up or sign in to vote.
4 Mar 2010
Arik Poznanski
In this article, I'll present how to use the ribbon application menu.
Please Sign up or sign in to vote.
21 Mar 2010
Arik Poznanski
In this article, I'll present how to work with ribbon contextual tabs.
Please Sign up or sign in to vote.
23 Mar 2010
Arik Poznanski
In this article, I'll present how to work with the ribbon recent items control.
Please Sign up or sign in to vote.
30 Nov 2011
Marc Clifton
Revisiting the XTree implementation, using a generic controller.
Please Sign up or sign in to vote.
8 Mar 2013
Michael Haephrati
Generally speaking you need to use separate threads for the loading. I don't know what your application does during these long seconds, but whatever is done, can be done in the background. During that time you can display a Splash screen (static or animated one), so the end user will not feel...
Please Sign up or sign in to vote.
21 Oct 2008
Günther M. FOIDL
A component that allows the customization of menu shortcuts. This can be useful for barrier free applications.
Please Sign up or sign in to vote.
19 Feb 2010
Uwe Keim
Small tool to monitor the clipboard for images and upload them to Twitpic
Please Sign up or sign in to vote.
16 Mar 2010
Arik Poznanski
In this article, I'll present how to use the ribbon font control.
Please Sign up or sign in to vote.
15 May 2011
kribo
How to insert images / binary data into a database.
Please Sign up or sign in to vote.
19 Feb 2021
Leif Simon Goodwin
A 3D surface plot control in C#
Please Sign up or sign in to vote.
17 Aug 2009
Paw Jershauge
An easy to use ListView group sorter (very simple).
Please Sign up or sign in to vote.
30 May 2011
Sergey Alexandrovich Kryukov
Well, if you try to create artificially simplified use cases as you present in your Question, you don't have a chance to see "Extra Advantage", right?I would prefer talking not about "advantage", but about a principal technological feature. What's so special about delegates; what is the...
Please Sign up or sign in to vote.
3 Apr 2012
Alan N
There is something odd about the ForeColor property of a read only System.Windows.Form.TextBox which I haven't seen documented, although I haven't looked very hard.I've noticed that a foreground colour change only takes effect after the background colour has been changed once. After that...
Please Sign up or sign in to vote.
26 Aug 2012
Wendelius
1 alternative  
The tip shows one way to resolve if a user control is in design mode.
Please Sign up or sign in to vote.
5 Jul 2013
Johnny J.
A sample owner-drawn ComboBox
Please Sign up or sign in to vote.
14 Aug 2013
adriancs
A program/application for learning and writing HTML. Get instant visual effect side by side with your code as you type. Support HTML5, Javascript and CSS3 elements.
Please Sign up or sign in to vote.
16 Feb 2014
RhishikeshLathe
Completely Remove flickering due to TableLayoutPanel & Panel in windows form go as follows:=-1. Set double buffered property of Form =true.2. Paste Following 2 functions in form.cs#region .. Double Buffered function .. public static void...
Please Sign up or sign in to vote.
29 Jun 2016
The Zakies
we would create Hand_tool to pan through the drawing form, and we would use a custom cursor of open and closed hands
Please Sign up or sign in to vote.
19 Feb 2011
#realJSOP
2 alternatives  
Determine the number of unique colors in an image
Please Sign up or sign in to vote.
22 Mar 2012
Shahin Khorshidnia
HelloLook at this:http://msdn.microsoft.com/en-us/library/system.threading.eventwaithandle.aspx[^]And pay attention to EventWaitHandle.WaitOnehttp://msdn.microsoft.com/en-us/library/system.threading.eventwaithandle.waitone.aspx[^]
Please Sign up or sign in to vote.
9 Mar 2010
marc ochsenmeier
Use the new PLA interface to monitor performance counters and trigger alerts.
Please Sign up or sign in to vote.
7 Feb 2011
Espen Harlinn
Windows Forms does not support the idea of event bubbling, but you can always add an event to your UserControl, route all mouse click events for the child controls to a single event handler, and then fire the event.RegardsEspen Harlinn
Please Sign up or sign in to vote.
26 Jul 2011
OriginalGriff
For goodness sake! You need to do some basic research into voice regocnition. As I suggested to you yesterday, google can help, but you are going to have to do some work.The simple approach you are trying to use will never work. Why not? A first, simple reason:When did you start talking...
Please Sign up or sign in to vote.
3 Apr 2012
OriginalGriff
You can't, without a lot of work.When you set the textbox to readonly, the foreground and background colours are overridden and ignored in favour of the system disabled colors - and it is a BAAAAD idea to change them.The easiest way to do it would be to create your own control, derived...
Please Sign up or sign in to vote.
1 May 2012
Ivan Ičin
Custom WinForm ToolStrip that fixes some of the ToolTip related problems and adds few related features
Please Sign up or sign in to vote.
6 Mar 2016
Hiske Bekkering
A simple explanation of how to synchronize custom painting with a ProgressBar's default painting.
Please Sign up or sign in to vote.
20 Mar 2016
Afzaal Ahmad Zeeshan
In this episode I am going to talk about using graphical applications in Mono. The graphical framework to use would be Windows Forms.
Please Sign up or sign in to vote.
28 Apr 2010
Keith Barrow
2 alternatives  
If you have a Winforms application that auto loads data, there is no doubt that you’ll have come across the problem of data loading at design time (i.e. when opening the code in the designer). At best, this slows the designer down, at worst it might crash VS and prevent the control from...
Please Sign up or sign in to vote.
1 Apr 2010
Brian C Hart
An adaptation of Nick Thissen's article on VBForums translated to C# and bottled up into a Class Library you can just drop into your projects.
Please Sign up or sign in to vote.
26 Jan 2011
#realJSOP
When you need to communicate with the app that contains your ServiceHost object, use custom events
Please Sign up or sign in to vote.
9 Apr 2011
Nish Nishant
Yeah, that is standard behavior with the ComboBox (in Winforms). Once you drop down the control, then even if you select the same item that was previously selected, SelectedValueChanged will fire! I reckon you'd have to keep a currentSelectedValue and then compare against that each time it...
Please Sign up or sign in to vote.
5 May 2011
OriginalGriff
Please don't!That's the simple answer. You can't access the buttons on a differnt form because they are declared private by default. If they weren't, then the two forms are always tied together - if you change one, you have to look at how that change might affect the other form. This makes...
Please Sign up or sign in to vote.
4 Jun 2011
Sergey Alexandrovich Kryukov
What Abhinav suggested is not so practical in terms of performance and may not be suitable for big files.Here is what you can do:static void CopyFileWithExcludedLine(string inputFileName, string outputFileName, ulong excludeLine) { ulong lineCounter = 0; ...
Please Sign up or sign in to vote.
27 Jun 2011
charles henington
1 alternative  
Please Sign up or sign in to vote.
29 Nov 2011
Savalia Manoj M
You Can try it in MS-SQL Like Declare @Month BigintSet @Month =11Declare @date date;Set @date='2011-11-01'while DATEPART(Month,@date)=@MonthBegin --Select DATEPART(DAY,@date); --Select DATEPART( WEEKDAY, @DATE ) DECLARE @Name VARCHAR(20) SELECT @Name = CASE (...
Please Sign up or sign in to vote.
8 Jan 2012
William SerGio
Resizable Skins Made from Web Pages with Video
Please Sign up or sign in to vote.
31 Jan 2012
CPallini
C# has no global variables. Possibly do you mean a class member variable?In the reset button you are declaring (and initializing) a new instance of the variable and thus shadowing the (possible) class member variable.You have to change (in the reset button command handler) from:...
Please Sign up or sign in to vote.
16 Jul 2012
OriginalGriff
There is only one way: to create an abstract class that inherits Form, and derive your form from that. It can then also implement the interfaces.You cannot derive from an abstract class and the Form class together - the inheritance hierarchy only allows the one base class, abstract or...
Please Sign up or sign in to vote.
19 Sep 2014
Abdul Samad KP
public void Excecutesql( params object[] Obj) { }
Please Sign up or sign in to vote.
8 Jun 2015
Dirk_Strauss
LEADTOOLS Recognition Imaging SDK - I had the pleasure of taking the SDK for a spin, and let me tell you it was well worth it.
Please Sign up or sign in to vote.
2 Sep 2015
Richard MacCutchan
Please learn how to use Google: https://www.google.com/search?q=register+assembly+in+GAC[^].
Please Sign up or sign in to vote.
2 Sep 2015
Maciej Los
The best way to learn is to read the documentation:Global Assembly Cache[^]How to: Install an Assembly into the Global Assembly Cache[^]
Please Sign up or sign in to vote.
1 Oct 2015
Steve Aube 1
This article describes a new alternative approach for Automated Testing of User Interfaces (UI).
Please Sign up or sign in to vote.
8 Nov 2016
Niemand25
A simple way to place any ObjectListView inside a ComboBox
Please Sign up or sign in to vote.
10 Nov 2016
Mehedi Shams
Coding a simple magic with cards!
Please Sign up or sign in to vote.
30 Dec 2007
AGD-H
Knit is a Visual Studio add-in tool that allows a developer to apply multi-step patterns to solution and assembly meta-data.
Please Sign up or sign in to vote.
26 Jan 2010
#realJSOP
My most often used design pattern is the SWC pattern (Start Writing Code). It has served me well for almost 30 years.
Please Sign up or sign in to vote.
26 Apr 2010
George Henry 1954
Presents a class that facilitates high-usability binding of an ordinary TextBox to a numeric property
Please Sign up or sign in to vote.
31 May 2010
PSK_
On button click Try this. Process.Start(@"C:\YourFolder\"); The Process class exists in System.Diagnostics namespace.
Please Sign up or sign in to vote.
1 Nov 2010
Dave Paras
Copy following code in the click event of button.Don't forget to change the Location of button, next time...private void button1_Click(object sender, EventArgs e){ System.Windows.Forms.Label lbl = new Label(); lbl.Text = "Paras" lbl.Location = new System.Drawing.Point(0, 0); ...
Please Sign up or sign in to vote.
31 Jan 2011
Debojyoti Majumder
One more point I want to add.If you want to use LoadLibrary()/GetProcAddress() to use methods of .dll files you have use delegates.It's one of the ways to connect C# codes to C++ codes.
Please Sign up or sign in to vote.
2 May 2011
Olivier Levrey
Handle the Paint event for your panel, and put all your drawing code inside that handler.public Form1(){ InitializeComponent(); //handle the Paint event for the panel panel1.Paint += (sender, e) => { //put you drawing code here //and use...
Please Sign up or sign in to vote.
22 May 2011
Sergey Alexandrovich Kryukov
First of all, there is not such relationship as child-parent forms. [EDIT: There are MDIParent and MDIChildren, but this is not exactly the same thing. Also, I don't think we discuss MDI. Thanks to CS2011 who pointed out that relationship between forms in case of MDI.] There are Owned...
Please Sign up or sign in to vote.
27 Jul 2011
Sergey Alexandrovich Kryukov
Totally wrong approach! I agree with Griff. Your problem is fairly simple.Store text password in your database. Do it in hashed form using some cryptographic hash function, see http://en.wikipedia.org/wiki/Cryptographic_hash_function[^]. Use one of the functions from the SHA family, see...
Please Sign up or sign in to vote.
12 Sep 2011
Kim Togo
If you want to use TCP connection, then there is NO broadcast. TCP[^] is a point to point protocol.Check out UDP[^].
Please Sign up or sign in to vote.
20 Nov 2011
Bernhard Hiller
That's far too obscure.All you need to do is store a reference to the TabPage instance which was removed from the TabPages collection of the TabControl. You may use the form where the TabControl is placed for that purpose.You could also create your own TabControl which has an extra property...
Please Sign up or sign in to vote.
20 Dec 2011
Giorgi Dalakishvili
Bugs in System.Diagnostics.Process Class
Please Sign up or sign in to vote.
26 Jan 2012
hoernchenmeister
1 alternative  
Hi all,Our application consists of several solutions. It uses MEF to plugin functional parts, that is all fine.I now try to find a way to share resources across all of those projects.Currently I create a dll containing a public resource file hosting images I need in all of my other...
Please Sign up or sign in to vote.
22 Mar 2012
Sergey Alexandrovich Kryukov
I would like to add to the correct answer by Shahin. Using WaitOne if free from the problems of thread suspensions. If an instance of an event wait handle is not set, the calling thread waits in a special wait state. OS switches the calling thread off and do not schedule it back to execution...
Please Sign up or sign in to vote.
29 Apr 2012
OriginalGriff
Probably not, from your description.A TextBox only holds Text - strings, and sorting is not one of it's features.However, assuming your TextBox is multiline, it would be possible to put them into the TextBox in sorted order:struct MyStruct : IComparable { public string...
Please Sign up or sign in to vote.
6 Mar 2013
wmjordan
Rendering text with OpenType fonts by P/Invoking GDI API in WinForm applications.
Please Sign up or sign in to vote.
5 Oct 2014
morzel
How to shoot paintball marker with relay, Arduino and .NET Winforms
Please Sign up or sign in to vote.
1 Apr 2015
Sergey Alexandrovich Kryukov
You did show where the exception with the message "Object reference not set to an instance of an object" is thrown, but you did not provide all the detail. Fortunately, the authors of other answers were able to point it out. But you cannot ask this question every time it happens, need, to learn...
Please Sign up or sign in to vote.
3 Mar 2017
Paolo Foti
Save and restore your design work using a persistence manager based on XAML code
Please Sign up or sign in to vote.
7 Dec 2017
Dukhabandhu Sahoo
This article explains how to display a loading indicator (a GIF image) in Windows Forms application when some long running task is performed in the background.
Please Sign up or sign in to vote.
10 Mar 2018
Joe Dillon
This article describes the security techniques required to create a secure offline password manager and how the Libsodium library has been used to achieve this. YAPM stores passwords with AES encryption and authenticates users with an Argon2 hash.
Please Sign up or sign in to vote.
11 Oct 2020
Dmitriy Sobeshchanskiy
An overview of logic and GUI controls for MRU functionality
Please Sign up or sign in to vote.
3 Apr 2008
slkr171
This article describes how to build a lightweight test bench for testing user interfaces which are written entirely in C#/.NET, using NUnit or any other unit test framework.
Please Sign up or sign in to vote.
15 Dec 2010
EFEaglehouse
Windows CE/Mobile printing client for LPR, LPRng, and Socket API.
Please Sign up or sign in to vote.
18 Jan 2011
creizlein
3 alternatives  
Is there any way to programmatically call and host the default property dialog for a file and/or for a service ? So far I haven't found anything related but I'm pretty sure that there has to be a way; at least using some Win32 API calls.As answers start to appear i found that display the...
Please Sign up or sign in to vote.
26 Jan 2011
Ryan Zahra
You can get the value of the check box by getting the value from checkbox.checked which returns either true or false. You can save the value either in a text file or in a database, depends on what you really want to do. When your application is started, you can load the value from the text file...
Please Sign up or sign in to vote.
15 Feb 2011
OriginalGriff
Easy:private void MyExistingButton_Click(object sender, EventArgs e) { Button myNewButton = new Button(); myNewButton.Text = "ClickMe"; myNewButton.Location = new Point((Width - myNewButton.Width) / 2, (Height - myNewButton.Height) / 2); myNewButton.Click += new...
Please Sign up or sign in to vote.
17 Feb 2011
OriginalGriff
It will depend on how you want the form1 to work: If form1 closes as well when you press the button, then set up two properties which provide access to the TextBox content and read them from mainForm. I would suggest using form1.ShowDialog in this case, rather than form1.Show.If form1...
Please Sign up or sign in to vote.
17 Feb 2011
Ashishmau
Hi,instead of using .tostring() use Convert.tostring() as it handles null valuesu can write likeif(Convert.Tostring(MainGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)){ // do sonmthing}Hope it helps.......... :-O
Please Sign up or sign in to vote.
21 Mar 2011
CDP1802
You forgot to tell us what you are using. WPF? Windows Forms?If it's Windows Forms, then the solution may be quite easy: You have drawn something and then minimize the form. When it is restored, all controls are told to redraw their contents and the old content is lost. You must simply...
Please Sign up or sign in to vote.
30 Mar 2011
Dylan Morley
Have a look at this thread on Stack Overflowhttp://stackoverflow.com/questions/3542061/how-do-i-stop-a-thread-when-my-winform-application-closes[^]In particular, the second answer should give you a clue" If you create the new threads as background threads (by setting IsBackground...
Please Sign up or sign in to vote.
9 Apr 2011
Henry Minute
If you read the MSDN page[^] for SelectedValue property you will see that the 'value' it is referring to is the value of the ValueMember property. So it may not actually be the event that you need if you are not using data binding.This doesn't explain the problems you are seeing, of course...
Please Sign up or sign in to vote.
13 Apr 2011
Toli Cuturicu
It is indeed possible.There is a ready made class for this, here on CodeProject.Just use the CodeProject Search feature!Good luck!If you really can't find it... try here: Localizing System MessageBox[^]
Please Sign up or sign in to vote.
15 Apr 2011
OriginalGriff
Try: DataGridViewRow r = dataGridView1.SelectedRows[0]; if (r != null) { r.ReadOnly = false; }
Please Sign up or sign in to vote.
24 Apr 2011
Wayne Ye
Personal Schedule Management Tool
Please Sign up or sign in to vote.
12 May 2011
Wayne Gaylard
You could try setting the Forms DoubleBuffered Property to true.
Please Sign up or sign in to vote.
5 Jun 2012
Sergey Alexandrovich Kryukov
No, it is not helpful for anything related to COM (by the way, why using COM at all?!).It can be useful to create some assembly which can be used almost exclusively as a library. You can actually use it as application, but the only way to return anything I can see right now would be the exit...
Please Sign up or sign in to vote.
5 Jun 2011
Sergey Alexandrovich Kryukov
This is what it is: you did not instantiate one of the reference-type objects, so one of them is null, or some code explicitly assigned null to the variable. In your case, this is uninitialized ListUrls. After you constructed the structure, it's null. Use New to create a list. Add a constructor...
Please Sign up or sign in to vote.
11 Jul 2011
BobJanova
Don't do it.Your controls should reflect the state of business objects (whether through formal data binding or, for a simple case, through setting properties in event handlers). In a really simple application (one form) the 'business objects' can be local fields of the form. Then, in other...
Please Sign up or sign in to vote.
13 Sep 2011
Mehdi Gholam
The general principal to keep in mind is don't make more work for yourself than is absolutely necessary. Most clients and users don't care about how and where their data is stored unless it is safe and consistent. Rarely to client insist on using a specific type of database engine.In...
Please Sign up or sign in to vote.
15 Sep 2011
Nathan Stiles
A class written to easily handle long paths (32K in length) using .NET.
Please Sign up or sign in to vote.
20 Nov 2011
Valery Possoz
Hello,Assu...
Please Sign up or sign in to vote.
3 Jan 2012
PIEBALDconsult
1 alternative  
Getting the line and position of the cursor in a TextBox
Please Sign up or sign in to vote.
2 Jan 2012
Wendelius
Have a look at the BackgroundWorker Class[^]. You could execute your logic using the background worker and offer the user a possibility to cancel the execution by calling CancelAsync [^] in the button.
Please Sign up or sign in to vote.
24 Jan 2012
Shahin Khorshidnia
Hello,I did almost a same thing but by WPF for a company.I made some Icons that they where connected together with lines. (Like VISIO)I've never seen any prepared user control for connector point. At leat I don't know.I built it and I think you have to build.1. Save dimensions...
Please Sign up or sign in to vote.
26 Jan 2012
Sergey Alexandrovich Kryukov
Resources are designed to be internal to the assembly. However, the problem is solvable. You need to put all resources in one or more special resource-only assemblies and provide a special facade class (or classes) used exclusively to expose the resource to the assemblies referencing your...
Please Sign up or sign in to vote.
25 Jan 2012
Sergey Alexandrovich Kryukov
My advice is: don't do it this way. This is possible in principle; I knew few attempts, all pretty much unsuccessful; and it's clear why.I explained what to do in my past solution: Drawing Lines between mdi child forms[^].The question is not exactly the same as yours, but the right...
Please Sign up or sign in to vote.
25 Jan 2012
Espen Harlinn
I think you are looking for something like this:WPF Diagram Designer - Part 1[^]WPF Diagram Designer - Part 2[^]WPF Diagram Designer - Part 3[^]WPF Diagram Designer - Part 4[^]The articles are well written and the concepts fundamental to WPF designer integration, but if you are new...
Please Sign up or sign in to vote.
25 Jan 2012
Sergey Alexandrovich Kryukov
Now, lets turn to WPF and let me give you some further ideas before we close this discussion and you continue on your own. I hope you will choose to accept this one formally, too. (You can click green "Accept" button on more than one.)With WPF, you can put all your diagram elements on the...
Please Sign up or sign in to vote.
3 Feb 2012
Manfred Rudolf Bihy
Since .NET 4.0 we have the DirectoryInfo class[^] with the method EnumerateDirectories and EnumerateDirectories(path).Example from MSDN:// Create a DirectoryInfo of the Program Files directory.DirectoryInfo dirPrograms = new DirectoryInfo(@"c:\program files");DateTime StartOf2009 =...
Please Sign up or sign in to vote.
8 Feb 2012
Sergey Alexandrovich Kryukov
This event won't help you much. Use another event System.Windows.Forms.Control.KeyDown. It works with different event arguments parameter type, System.Windows.Forms.KeyEventArgs, the one you really can use with functional keys.Use comparisons like if eventArgs.KeyCode = Keys.F1...
Please Sign up or sign in to vote.
1 Mar 2012
Shahin Khorshidnia
Sorry again. May I suggest another working method?1. In your database:have a Table (for example Person)Person:ID BigInt (PK)Name NVarChar(50) ...Node_ID BigInt (FK)Node_ID refers to IDIf Node_ID = Null then It means the record is a...
Please Sign up or sign in to vote.
17 Apr 2012
VJ Reddy
TX TextControl is a very good Word processing control with several features as which can be reviewed at their websitehttp://www.textcontrol.com/en_US/[^]
Please Sign up or sign in to vote.
22 Apr 2012
Sergey Alexandrovich Kryukov
The problem is not simple at all. It looks like there is no any practical alternative to debugging, but we have some remote and limited hope for something better.Let's say we need some definitive automated diagnostics of the infinite loop problem. It can be embedded in the program in...
Please Sign up or sign in to vote.
9 May 2012
Sergey Alexandrovich Kryukov
I hope you won't be able to kill them all, it cannot make any sense, anyway, but why would I care if you want to screw up your system? You will reboot it (because you hardly will be able to work at all if you kill some of the critically important applications).Whatever. Those are not...
Please Sign up or sign in to vote.
11 Jun 2012
Shahin Khorshidnia
HelloUse ObservableCollection instead of ListFor example:private ObservableCollection _myProperty;public ObservableCollection MyProperty{ get { return _myProperty; } set { _myProperty = value; ...
Please Sign up or sign in to vote.
20 Jul 2012
Sergey Alexandrovich Kryukov
If you feel that you really need it, it tells me that your UI design is not good. You should revise it. You are not supposed to prevent the user from doing something with is the part of user's natural rights: arrange individual top-level windows the way they want.If I saw such behavior, for...
Please Sign up or sign in to vote.
8 Aug 2012
Albert Holguin
To be honest with you, I have yet to find an automated tool that works better than the human mind. This is probably a task you want to do yourself, why? ..because you can rationalize what makes sense and what doesn't, further more, you can work as the tester in the loop simultaneously by making...
Please Sign up or sign in to vote.
16 Aug 2012
Alan N
I was hoping that this was going to a problem about the complexities of AutoSizing, but perhaps you have just inadvertantly set AutoSize on the main form.Alan!
Please Sign up or sign in to vote.
13 Feb 2013
_Maxxx_
edo is correct - the problem is in the use of quotes in the string you need to insert.The easiest solution is to parameterise the queryCmd.CommandText = "insert into Table1 values(@myString)";cmd.Parameters.Add("@myString", SqlDbType.String).Value = textBox1.Text;
Please Sign up or sign in to vote.
21 Feb 2013
Mitchell J.
Use a custom rounding system:public int Round(double value){ double decimalpoints = Math.Abs(value - Math.Floor(value)); if (decimalpoints > 0.5) return (int)Math.Round(value); else return (int)Math.Floor(value);}Hope this helps. :-)
Please Sign up or sign in to vote.
9 Mar 2013
Michael Haephrati
It is not clear what you are developing. If you are developing a piece of software for someone else, you should create your own Print routine which will call printDocument 4 times, each time with the appropriate text. There is no way around that. Print drivers can usually allow you to define odd...
Please Sign up or sign in to vote.
26 May 2013
Aravind.V.S
SocketIO - NodeJS desktop programming in C# using the SocketIO4Net library.
Please Sign up or sign in to vote.
17 Aug 2013
adriancs
An Office 2010 Style Color Picker for .NET WinForm.
Please Sign up or sign in to vote.
6 Sep 2013
Magnus_
This is an alternative for "Solving the .resx Merge Problem "
Please Sign up or sign in to vote.
30 Oct 2013
Sergey Alexandrovich Kryukov
When two or more threads try to get the lock on the same lock object, only one can pass, other threads are blocked to a wait state (which does not spend any CPU time until a thread is waken up, by such condition as release of the lock by other threads, abort or timeout), and the threads in the...
Please Sign up or sign in to vote.
4 Nov 2013
Sergey Alexandrovich Kryukov
This is the popular question about form collaboration. The most robust solution is implementation of an appropriate interface in form class and passing the interface reference instead of reference to a "whole instance" of a Form. Please see my past solution for more detail: How to copy all the...
Please Sign up or sign in to vote.
14 Nov 2013
Volynsky Alex
The best way to achieve this is probably to dynamically generate the report itself. There are a large number of questions and answers on that subjectLet's look following post - "Step by Step Tips - Adding custom columns of Crystal Reports"...
Please Sign up or sign in to vote.
25 Dec 2013
BillWoodruff
There's a much easier way to do this that doesn't require over-riding 'OnKeyPress. Assume the KeyDown and KeyUp EventHandlers shown below are wired-up to your MDIChildForm, and that its KeyPreview Property is set to 'true.private bool IsAltDown = false;private bool IsToolTipsShown =...
Please Sign up or sign in to vote.
26 Jan 2014
User 59241
Does this help?How to write WMI Query to find USB MODEMS IN C#[^]
Please Sign up or sign in to vote.
25 May 2014
Thomas Daniels
You can achieve this by using the Threads window while debugging. If you want to switch to a thread, right-click on the desired thread and click "Switch To Thread". If you cannot find your thread, then give it a name to find it faster:yourThread.Name = "Thread Name";Now, the thread...
Please Sign up or sign in to vote.
5 Jan 2015
BillWoodruff
Windows Forms is a high-level meta-construct that uses the .NET FrameWork; it creates a level of abstraction above the lower-level API calls that it uses: it hides the lower-level usage from casual view. Of course, Windows Forms does not use everything in the FrameWork !Windows Forms...
Please Sign up or sign in to vote.
5 Jan 2015
DamithSL
sample code:var splitwords =new string[] {"egg","eggs", "have a receipt"}; string input ="I have a receipt with eggs but others with just one egg";foreach (string word in splitwords){ var regex = new Regex(@"(?
Please Sign up or sign in to vote.
15 Jan 2015
CPallini
Assuming 'code reusing' is not a requirement (otherwise you probably would have already followed the MFC 11 migration path), I would do some tests toward the fully managed path (that is all C#) with option 4 (that is C# GUI, C++ for time critical components) as plan B.
Please Sign up or sign in to vote.
15 Jan 2015
Sergey Alexandrovich Kryukov
I rather agree with Solution 2. My answers:1. Quick Questions & Answer might be not the most suitable place for such a wide problem, but main idea could be: don't assume you migrate; you create the system from scratch, because the technologies are very different. Consider it as a benefit:...
Please Sign up or sign in to vote.
18 Feb 2015
Alvin Ashcraft
This year I have been looking at and starting to use several components from the Universal 14.2.4 release.
Please Sign up or sign in to vote.
28 Mar 2015
Richard MacCutchan
An integer gives you a range of 0 to 2,147,483,647, which should be plenty for a 150 Kb file.
Please Sign up or sign in to vote.
2 Sep 2015
Sergey Alexandrovich Kryukov
See also: https://en.wikipedia.org/wiki/Global_Assembly_Cache[^].The main idea behind GAC is to references commonly-used assemblies by their strong names, not by locations/names of their main modules. And the strong name, with assembly version, is supposed to be world-unique. In turn, strong...
Please Sign up or sign in to vote.
25 May 2019
Dave Kreskowiak
Controls do not know about each other, and nor should they. Your form is what should be passing data between controls. Your user control should expose the data it needs to as a property and also expose an event your form can subscribe to to be notified that the data in the property changed. ...
Please Sign up or sign in to vote.
9 Jul 2009
Polanek
A WinForms sample application for the Domain Specific Language created with Irony.
Please Sign up or sign in to vote.
28 Aug 2009
EliottA
1 alternative  
I'm making use of an extensive library of custom controls to create a dynamically constructed menu based off a data table I've received. All is well and fine, and I've added my controls to a FlowLayoutPanel (which had issues reordering controls embedded within due to the fact it's visibility was
Please Sign up or sign in to vote.
11 Apr 2010
Mohammad Elsheimy
Give the user the flexibility to design his sheet, report, bill, invoice, whatever.
Please Sign up or sign in to vote.
26 May 2010
AlexCode
A way to audit your business objects using NLog.
Please Sign up or sign in to vote.
3 Aug 2010
Raymund Macaalay
User Impersonation in Windows Forms Application
Please Sign up or sign in to vote.
11 Jun 2010
Anshul R
Chr(e.KeyCode) for retrieving the character.If you want to retrieve the last typed character, use TextBox1.Text(TextBox1.TextLength-1)
Please Sign up or sign in to vote.
15 Oct 2010
Johnny J.
Here[^]'s a good explanation on designing resizable forms.If you mean that you want to resize all controls and maintain aspect ratio etc, then you need to use a 3rd party library. This[^] is really good...
Please Sign up or sign in to vote.
26 Oct 2010
Craigjw
1 alternative  
I have been writing winforms for a while now and I still haven't worked out a decent way of tracking what controls are active at a given time depending on particular conditions, for example, are all text boxes non null or white space, has the appropriate options been selected, in which case...
Please Sign up or sign in to vote.
16 Nov 2010
Hemant__Sharma
1 alternative  
Hi all,I have a WinForm project in C# .NET 3.5. The UI looks perfect on 96 DPI resolution but clips text and/or overlaps some controls if the resolution is 120 DPI bcz its making all controls 25% bigger than 96 DPI.Using AutoScaleMode is not helping. The new requirement for our project is...
Please Sign up or sign in to vote.
28 Dec 2010
RaviRanjanKr
To Learn about UserControl you should Navigate the Given LinkUser Control With C#[^]
Please Sign up or sign in to vote.
24 Jan 2011
E.F. Nijboer
You can use the methods PointToClient and PointToScreen to do this.http://msdn.microsoft.com/en-us/library/ms229598.aspx[^]Good luck!
Please Sign up or sign in to vote.
26 Jan 2011
Christian Graus
Your obvious bet is to integrate a web browser control, assuming your user is online or it lets you browse to a local page.
Please Sign up or sign in to vote.
26 Jan 2011
Orcun Iyigun
You can do it in two ways I think;1st;On your toolbox right click on it and choose the "Choose items". When the page shows up choose "COM components". Then on the list find Shockwave Flash Object. Select it and it will appear under your components tab. Drag it your form and give the URL of...
Please Sign up or sign in to vote.
26 Jan 2011
Manfred Rudolf Bihy
Shockwave Flash Object has these methods/properties you can use:AxShockwaveFlash1.Stop()AxShockwaveFlash1.Movie = FilePath & "\yourflashfile.swf"AxShockwaveFlash1.Play()Hope that helps!
Please Sign up or sign in to vote.
31 Jan 2011
Nick Alexeev
3 alternatives  
Colleagues,...
Please Sign up or sign in to vote.
7 Feb 2011
Nish Nishant
As far as I know, there's no way to do this except via a mouse hook (which may be overkill for this). Instead you could handle the child's Click event in the UserControl class (which should basically give you the same flexibility).
Please Sign up or sign in to vote.
25 Feb 2011
Sridhar Patnayak
avoid data base connections in loops avoid unnecessary conversions
Please Sign up or sign in to vote.
14 Mar 2011
Olivier Levrey
Try something like://center of the rotationPointF center = new PointF(...);//angle in degreesfloat angle = 45.0f;//use a rotation matrixusing (Matrix rotate = new Matrix()){ //used to restore g.Transform previous state GraphicsContainer container =...
Please Sign up or sign in to vote.
16 Mar 2011
Espen Harlinn
There may be an error in the wav, or it uses a poorly implemented codec - this is often the cause for this kind of behaviour.RegardsEspen Harlinn
Please Sign up or sign in to vote.
7 Apr 2011
#realJSOP
You can add any control to the Controls collection in a form or container.Chances are that you made some critical errors when you changed over from use the Tag property/ArrayList to using the more appropriate collection (Controls).
Please Sign up or sign in to vote.
15 Apr 2011
OriginalGriff
In theory, anything that works in "true" .NET will work exactly the same in Mono.:laugh::laugh::laugh::laugh::laugh:I practice, most of it will. Some of it will work pretty closely, some will fail completely, and some isn't implemented at all.Provided you stick to .NET 2.0 most of...
Please Sign up or sign in to vote.
15 May 2011
#realJSOP
For winforms login:User Login For WinForm Applications[^]For Opening another form after logging in:Multiple Subsequent "Main" Forms in C# Apps[^]
Please Sign up or sign in to vote.
1 Jun 2011
Espen Harlinn
Take a look at How to: Bind Objects to Windows Form Controls[^] - no need to put anything between. If you want to use DataSet, DataTable and adapters, I think it's better to just stick with the "old" Fill way of doing things.An aternative is to use something like:Database Helper v...
Please Sign up or sign in to vote.
1 Jun 2011
Wonde Tadesse
For such case an MVP[^] pattern is quite good.
Please Sign up or sign in to vote.
2 Jun 2011
Naren07
textbox1.Clear...
Please Sign up or sign in to vote.
6 Jun 2011
Dave Kreskowiak
Your code is making a huge assumption. The error occurs because you're assuming that root.SelectNodes("//a") is actually returning a collection of Nodes. You might want to check this return for null before you try and use it.The HasAttributes property doesn't take any parameters, so I have...
Please Sign up or sign in to vote.
19 Jun 2011
OriginalGriff
The problem is simple: you cannot access UI components except from the thread that created them - i.e. the UI thread.When you try from another thread it doesn't work, and should throw an exception.You need to PInvoke it:Private Sub ShowProgress(text As String) If InvokeRequired...
Please Sign up or sign in to vote.
6 Jul 2011
Brian C Hart
This tip shows how to add support for New Horizontal Tab Group and New Vertical Tab Group commands to the Window menu of an application using the DockPanel Suite by Weifen Luo, and some other minor improvements to help decided if at least one of your windows is docked to the side of the main form an
Please Sign up or sign in to vote.
8 Jul 2011
Sergey Alexandrovich Kryukov
Please see the answers to your previous question: How to allow My class to add custom fields and properties by other class on the fly[^].Let me tell you that you have no idea what you're trying to do. The field would be untyped and very hard to use. I would like to see how you cope with the...
Please Sign up or sign in to vote.
8 Jul 2011
OriginalGriff
This may be a silly question, but you do realize that you don't have to do anything drastic, or even complex to add information to any control at run time (or design time, though run time is more flexible).All controls have a Tag property, which you are free to use. It is an object...
Please Sign up or sign in to vote.
7 Jul 2011
Sergey Alexandrovich Kryukov
This is a popular question about form collaboration. The most robust method is implementation of appropriate interface in form class.Please see my past answer here: How to copy all the items between listboxes in two forms[^].See also other suggestions and discussion.—SA
Please Sign up or sign in to vote.
9 Jul 2011
DaveAuld
There is a technical blog article on the subject;Face Recognition Project: Introduction To Face Recognition[^]
Please Sign up or sign in to vote.
17 Jul 2011
Sergey Alexandrovich Kryukov
The question is too general, and the specific detail does not go beyond the very usual uses of WCF. So, to help you one would need to understand what are your difficulties.I can only give very general recommendations:Use self-hosting WCF hosted on the server. This is the simplest and...
Please Sign up or sign in to vote.
19 Jul 2011
lukeer
I may very well be wrong, but your code looks a lot more like C++ than C#.As for your question, WindowsForms provides a class BackgroundWorker in the System.ComponentModel namespace. It's a very convenient way of using a separate thread. MSDN[^] gives an example on how to use it.To put...
Please Sign up or sign in to vote.
24 Aug 2011
Simon Bang Terkildsen
Use List[^] instead of an array soList badEmail = new List();List goodEmail = new List();for (int i = 1; i
Please Sign up or sign in to vote.
19 Nov 2011
User008
Drag 'n Drop asynchronous files from an external server or device
Please Sign up or sign in to vote.
3 Dec 2011
Richard MacCutchan
Your C++ code is in a namespace MyMathFuncs, and C# will not be able to resolve that through the PInvoke mechanism as far as I am aware. Remove the namespace and make the functions simple C style, and also use extern "C" on the definitions; something like:// MathFuncsDll.h// Returns a +...
Please Sign up or sign in to vote.
9 Dec 2011
Abhinav S
You can do this in two ways.1) Build the logic to check for unique values yourself. In this case, everytime you insert a new row, first check if the serial number already exists. Loading them from the db before saving and then checking them would be the easiest though not the most efficient...
Please Sign up or sign in to vote.
22 Dec 2011
thatraja
Please browse here for previous answers(regarding Certifications) in Codeproject.Its one of the frequent questions in CP.Certifications related questions/answers - Codeproject search[^]For MS CertificationsMicrosoft Visual Studio Certification[^]Microsoft Certification[^]And you...
Please Sign up or sign in to vote.
2 Jan 2012
OriginalGriff
It depends on how you are doing it.If you have the long operation running in the UI thread (ie, you haven't moved it to a separate thread already) then it will block the user interface from doing anything - so it can't respond to you mouse clicks or button presses. There is a way round that,...
Please Sign up or sign in to vote.
25 Jan 2012
Abhinav S
Go throughhttp://www.c-sharpcorner.com/uploadfile/ankurmee/import-data-from-excel-to-datagridview-in-C-Sharp/[^].A video here[^].This may[^] help as well.
Please Sign up or sign in to vote.
28 Jan 2012
Amir Mahfoozi
You should always track opened word and excel applications to close them when your application exits.This is the code to release the word or excel application. This is for word application but change and use it for excel applications : wordApplication.Quit(SaveChanges:...
Please Sign up or sign in to vote.
31 Jan 2012
Sergey Alexandrovich Kryukov
If can do it if you throw out all code related to System.Windows.Forms. If your UI is well isolated from everything else, this is easy. If not, try to extract pure application logic, data processing, etc., everything not related to UI. If this is difficult, you better start from scratch, using...
Please Sign up or sign in to vote.
6 Feb 2012
Sander Rossel
What really helped me was the Microsoft certification program. In specific certificate 70-505. Though I never really took an exam I did read the self-paced training kit which helped me a lot in developing WinForm applications.This is the book I'm talking about.[^]This site wraps up some...
Please Sign up or sign in to vote.
22 Feb 2012
Sergey Alexandrovich Kryukov
There are enough of ready-to-use utilities and libraries, such as Open Source and multi-platform ImageMagic. Please see:http://en.wikipedia.org/wiki/ImageMagick[^],http://www.imagemagick.org/[^].As it comes with command-line utilities, you can easy write a batch file of one or two lines,...
Please Sign up or sign in to vote.
27 Feb 2012
Shahin Khorshidnia
HelloUse Nullable type in C#bool? b = null;See:http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=vs.80).aspx[^]And for your CheckBox, if your application is WPF, try...
Please Sign up or sign in to vote.
29 Feb 2012
Shahin Khorshidnia
You can also use DevExpress XtraBar It's demo is free.More information:http://www.devexpress.com/Products/NET/Controls/WinForms/Bars/index.xml[^]
Please Sign up or sign in to vote.
1 Mar 2012
fjdiewornncalwe
How do you intend to get the "real size" for a maximized form? Different users will potentially be using different resolutions on their monitors, so a maximized form on each of their systems will differ.I would suggest that you decide on a minimum size of your form based on the controls you...
Please Sign up or sign in to vote.
3 Mar 2012
Dave Kreskowiak
Not supported. Formatting of some RTF tags is global acrossed the entire document. You cannot load just "page 5" without losing some of the formatting.You either load the entire document or nothing at all.
Please Sign up or sign in to vote.
10 Mar 2012
ProEnggSoft
You can use SpaceBar to check or uncheck the CheckBoxColumn cell in DataGridView control.
Please Sign up or sign in to vote.
30 Mar 2012
Shahin Khorshidnia
Short Answer: You can'tBut you can create a Custom WinForm and use a TextBox on it with passoword Char.Look at this:Create your own inputbox
Please Sign up or sign in to vote.
2 Apr 2012
Reza Ahmadi
Hi, I presume you want to return Key rather than the Value in your dictionary, if so, you can use the following lambada expression to return "Logged" for example:object obj = objdic.Where(item => item.Value == 2).First().Key;it return "Logged" which is one of the keys in your...
Please Sign up or sign in to vote.
17 Apr 2012
VJ Reddy
The Merge method of DataTable can be used for this purpose as shown below:Private Sub Main() Dim people As New DataTable() people.Columns.Add("Id", GetType(Integer), Nothing) people.Columns.Add("Name", GetType(String), Nothing) people.PrimaryKey = New DataColumn()...
Please Sign up or sign in to vote.
22 Apr 2012
Sergey Alexandrovich Kryukov
The code you show has nothing to do with your goal "to open files any extension", but no code has anything to do with that. More exactly, extension do not matter (and, in modern file systems, there is no such thing as "extension", there is only some naming conventions to suggest (only suggest) a...
Please Sign up or sign in to vote.
25 Apr 2012
Wes Aday
You can use the Stopwatch class here[^] to do what you want.
Please Sign up or sign in to vote.
29 Apr 2012
VJ Reddy
The Solution 1 by OriginalGriff is very good. I have added this solution only to use LINQ by using the concept and data given by OriginalGriff in his solution.void Main(){ MyStruct[] arr = new MyStruct[] { new MyStruct("Joe", 1959), new MyStruct("Mike",...
Please Sign up or sign in to vote.
8 May 2012
Sergey Alexandrovich Kryukov
Your problem is reduced to the following one: the article you use uses a J# library and was written using when J# was not yet retired. You can get this code is you install it with .NET Framework v. 2.0. Please see:http://en.wikipedia.org/wiki/J_Sharp[^].This article explains how you can...
Please Sign up or sign in to vote.
11 May 2012
VJ Reddy
The following code can be used in the Click event of a Button, to find if any of the items in CheckedListBox is available in the ListBox. If available then the boolean flag notFound is set to false.bool notFound = true;checkedListBox1.Items.Cast().Select (s => { if...
Please Sign up or sign in to vote.
29 May 2012
Anoop Ananthan
Yes, the queries need to seperated by semi-colon ";"eg:string query = "insert into table1(x,y,z); update table2 set a = 23;"OledbCommand cmd = new OledbCommand(query, connection);...cmd.ExecuteNonQuery();
Please Sign up or sign in to vote.
29 May 2012
Prasad_Kulkarni
Yes, it can be; Microsoft Access supports Transactions [^]and they work quite well.Even so, if possible, use SQL Server Express. It's much more powerful than Access.
Please Sign up or sign in to vote.
2 Jun 2012
VJ Reddy
If it is required to deduct 30 days from the Date, then I think the AddDays method of DateTime class with negative number can be used as the Substract method of DateTime accepts a DateTime object and not a duration.DateTime date_Of_End = new DateTime(2012, 6, 02);DateTime date_Of_Bigin =...
Please Sign up or sign in to vote.
2 Jun 2012
Manas Bhardwaj
Adding to what VJ Reddy explained, I usually prefer to use TimeSpan[^]. It gives you flexibility when you want to have more accurate calculations. For eg. 30 days, 10 hours and 45 mins :)DateTime date_Of_End = new DateTime(2012, 6, 02);int duration = 30;TimeSpan tsDay =...
Please Sign up or sign in to vote.
7 Jun 2012
Ankur\m/
Salary for the month = Monthly Salary / Total no. of days in the month * (days worked + paid leaves)paid leaves can be calculated as,if Leaves taken > available leaves Paid Leaves = Available Leaveselse Paid leaves = Leave TakenNow you need to update the available...
Please Sign up or sign in to vote.
7 Jun 2012
Manas Bhardwaj
Looks like homework. And by the way it has nothing to with C# or .Net for that matter. You need the formula to calculate salary and write it in C# which shouldn't be difficult anyways.Apart from that, what you wrote is also not logical. Out of 31 days, someone comes to office for 20 days and...
Please Sign up or sign in to vote.
7 Jun 2012
RDBurmon
Hello Gowtham ,My suggestion is to divide basic salary by number of days in a month and then multiply it by number of non-paid leaves and deduct that amount from total salary.For Example Employee "John Kerry" has salary stucture as (Basic 5000.00 + HRA 2500.00 + Allowances 1500.00 +...
Please Sign up or sign in to vote.
13 Jun 2012
VJ Reddy
To read and write data from Access database the Typed DataSet feature can be used. With typed dataset a strongly typed class is made for each Table and Row so that the columns of the Table can be accessed like properties without hard coding the Column names as strings.A Walkthrough on...
Please Sign up or sign in to vote.
16 Jun 2012
Dave Kreskowiak
You don't need the Panel at all.Create your own DGV class by inheriting from it, then override the OnPaint method with something like:Public Class MyDGV Inherits DataGridView Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs) ...
Please Sign up or sign in to vote.
19 Jun 2012
OriginalGriff
They aren't comparable.The first way can only be executed on the SQL server, the second can only be executed on your application host pc. Unless the two are the same machine, the performance comparison is irrelevant.And the second example effectively causes the first to be executed on the...
Please Sign up or sign in to vote.
26 Jun 2012
OriginalGriff
There are several things to check, mostly to do with how you have configured your app.1) Do you have it set to x64 and the XP box is 32 bit?2) Do you have it set for a version of the framework that is not installed on the XP box?3) Does it need datafiles or command line parameters that...
Please Sign up or sign in to vote.
26 Jun 2012
Wonde Tadesse
Have a look these articles.1.Distributed transactions and TransactionScope [how to get it?][^]2.Entity Framework & Transactions[^]3.TransactionScope and DataAdapters[^]4.Handling transactions in .Net using TransactionScope[^]
Please Sign up or sign in to vote.
16 Jul 2012
Sergey Alexandrovich Kryukov
Please see my comment.I mean, on second though, I can share a very beneficial coding style, when it comes to implementing some interfaces, especially good with forms. This style is based on the fact that partial class declaration requires each element in the list of base classes or...
Please Sign up or sign in to vote.
16 Aug 2012
Clifford Nelson
1 alternative  
I have a simple form that has only a few controls on it. It will resize but only increase in size. What it up? private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new...
Please Sign up or sign in to vote.
6 Sep 2012
Sergey Alexandrovich Kryukov
Total CPU usage? I can tell you right away — 100% ;-)[EDIT]And if you need it not total, but per process, you can use the class from System.Diagnostics.PerformanceCounter:http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c[^]Good luck,—SA
Please Sign up or sign in to vote.
10 Sep 2012
vangapally Naveen Kumar
First Set The Data Grid Property EditMode to EditOnEnterSee This Link You May Get Some Ideahttp://www.vb-tips.com/dbpages.aspx?ID=9bc438e8-35da-4b05-98be-3ec7520240dd[^]
Please Sign up or sign in to vote.
12 Sep 2012
Clifford Nelson
Look at the following tip (do not consider it an article, although so classified): Converting Wildcards to Regexes[^]
Please Sign up or sign in to vote.
9 Oct 2012
tanweer
hi, try this:private void Form1_Load(object sender, EventArgs e) { label1.Text = System.DateTime.Now.ToString("F"); }
Please Sign up or sign in to vote.
26 Oct 2012
fjdiewornncalwe
Use event based communication. That way your UI conforms to proper coding etiquette.// In Form1 codeprivate void OnOpenForm2Click(object sender, EventArgs e){ var form2Obj = new Form2(); form2Obj.Shown += (o, args) => { btnOpenForm2.Enabled = false; }; form2Obj.FormClosed +=...
Please Sign up or sign in to vote.
2 Nov 2012
fjdiewornncalwe
A really quick google search turned up this article: Search and Highlight Text in RichTextBox[^]. Maybe you can get a starting point from here.
Please Sign up or sign in to vote.
24 Dec 2012
OriginalGriff
It';s not odd at all - it is exactly what you asked for: minutes/day/year.If you want the month on the other hand:user.StartDate.ToString("MM/dd/yyyy");Would probably be what you wanted.
Please Sign up or sign in to vote.
27 Dec 2012
Sergey Alexandrovich Kryukov
This control is nothing but a class, not a sealed one. So, naturally, you can create a derived class and add any property you want, as well as any other member:class MyTextBox : System.Windows.Forms.TextBox { string MyNewProperty { get; set; } // ...} // class...
Please Sign up or sign in to vote.
6 Feb 2013
Richard MacCutchan
That is the wrong way to do it. You should open your connection immediately before accessing the database, and close it immediately afterwards. Leaving the connection open all the time your application is running is very bad practice, and in the case of multi-user applications can seriously...
Please Sign up or sign in to vote.
11 Feb 2013
Jibesh
Update your insert statement like thiscmd.CommandText = "INSERT INTO Accountstbl (Username, Password)" + " VALUES (@Username,@Password)";this is because you are already passing the arguments to the query parametercmd.Parameters.AddWithValue("@Username",...
Please Sign up or sign in to vote.
21 Feb 2013
CHill60
public int myRound(double val){ return (int)Math.Floor(val + .49);}I don't like "magic numbers" so you might want to define a const double and swap it for the 0.49
Please Sign up or sign in to vote.
25 Feb 2013
Maksud Saifullah Pulak
Hope This Helps.Just copy and paste.SELECT dbo.custDetails.custID AS Expr1, dbo.custDetails.custName, dbo.custDetails.custLimit, dbo.custTransaction.custDueAmtFROM dbo.custTransaction INNER JOIN dbo.custDetails ON dbo.custTransaction.CustId =...
Please Sign up or sign in to vote.
15 Apr 2013
Sergey Alexandrovich Kryukov
What do you expect? You make your UI thread busy with lengthy operation, why could you expect some UI activity? By miracle? :-)And this is not related to a form. Why do you think that forms work independently?You need to execute all blocking or lengthy operations in a separate thread,...
Please Sign up or sign in to vote.
3 May 2013
OriginalGriff
Well no, it won't necessarily work, and it won't necessarily exit. Ever.The problem is that what you are building is not a valid suduko puzzle. Think of it this way:If you are building a three by three suduko (instead of your 9 by nine) and the first row comes out as:1 2 3A perfectly...
Please Sign up or sign in to vote.
14 May 2013
Dave Kreskowiak
In Windows Forms it's a giant pain in the ass. In WPF, it's incredibly easy!I think you're using the wrong application type...
Please Sign up or sign in to vote.
28 May 2013
Sergey Alexandrovich Kryukov
Please see my comments to the question. This is my answer.I also remembered that I tried some open-source products few years ago. Even though the acoustic input was very pure and based on Western equal temperament system (electronic keyboard), none of them demonstrated satisfactory results....
Please Sign up or sign in to vote.
23 Jun 2013
Ron Beyer
WPF is quite a bit different than WinForms, and much more powerful. WPF is based on XAML or eXtended Application Markup Language, which is a form of XML that defines a form. So in WPF you work very closely with the XAML and the .cs files to create rich UI's. People who work in WinForms...
Please Sign up or sign in to vote.
23 Jun 2013
Thomas Daniels
Hi,Use a Dictionary:http://msdn.microsoft.com/en-us/library/xfhwa508.aspx[^]Dictionary integers = new Dictionary();public Form1(){ InitializeComponent(); integers.Add("S", 5); integers.Add("A", 4); // do this for all your...
Please Sign up or sign in to vote.
29 Jul 2013
jackspero18
this is simple just fire on groupbox_Paint Eventprivate void groupBox1_Paint(object sender, PaintEventArgs e) { Graphics gfx = e.Graphics; Pen p = new Pen(Color.Orange, 3); gfx.DrawLine(p, 0, 5, 0, e.ClipRectangle.Height - 2); ...
Please Sign up or sign in to vote.
12 Aug 2013
Volynsky Alex
Please read following article below:http://blog.mayurtendulkar.com/2010/07/experience-with-crystal-reports.html[^]and it:http://www.techrepublic.com/forums/questions/crystal-reports-printing-on-dot-matrix-printers/[^]Regards,Alex.
Please Sign up or sign in to vote.
20 Aug 2013
OriginalGriff
Add an override method to your ProSailor class to handle ToString:public override string ToString() { return "Sailor " + Number + ", " + Age + "years of age has, " + NoOfSailsFin + " races completed!" }
Please Sign up or sign in to vote.
3 Sep 2013
Christopher Kenis
Here's a example of the code:public Form1() { InitializeComponent(); //Set the listView Visible property to false listView1.Visible = false; } private void button1_Click(object sender, EventArgs e) { ...
Please Sign up or sign in to vote.
15 Sep 2013
Sergey Alexandrovich Kryukov
You can use the open-source libVLC binding called LibVLC.NET: http://libvlcnet.codeplex.com/[^].The first page provides a small code sample and explains where to find the tutorial. This is all you need.—SA
Please Sign up or sign in to vote.
16 Sep 2013
Member 10040991
3 alternatives  
I've looked over several examples for this but can't seem to implement it properly. I'm writing a game and want to make a backup of the game pieces so the player can 'undo' a move, phase, or turn. All my copies seem to be shallow copies, and I'd like to implement a deep copy with ICloneable...
Please Sign up or sign in to vote.
17 Sep 2013
Joezer BH
Your date is all set for this one day, that's true, but it contains more than the date, it also contains the time! so comparing using both will result only in those entries which were inserted in the exact time point which probably returns nothing...If you want all entries of the day, in...
Please Sign up or sign in to vote.
17 Sep 2013
Fredrik Bornander
Change it to;string connstr = @"Server=NAME_OF_YOUR_SERVER_HERE\SQLEXPRESS ;Initial Catalog=DB;Integrated Security=True; Max Pool Size=100";Hope this helps,Fredrik
Please Sign up or sign in to vote.
2 Oct 2013
Ravi Bhavnani
Some suitable locations to save application data are the AppData folder or the user's MyDocuments folder. Environment.GetFolderPath()[^] is your friend./ravi