Well, I don't think I can make this any simpler. I hope newbies in the C# language can learn from it.
(Read More) Wanted to let two forms work together. One form would be the input form and the main form would consume this data. I managed to succeed with the help of a few of my friends here at daniweb., who helped me setup a static form.
Just posted a bit of the most relevant code here, the rest of the...
(Read More) Here is a sample code snippet of logging in a user against a user table in an MSSQL database with password encryption.
Scott Knake
Custom Software
Apex Software, Inc.
(Read More) A simple way to check if the current C# program is the only instance of itself running.
(Read More) The xor operator allows you to switch the values of two integer variables without the need for a third, temporary variable.
(Read More) Demonstrates using .NET Remoting to broadcast to client subscribers. There are three parts:
1) Server.cs - for console app responsible for broadcasting messages (date/time stamp currently)
2) Client.cs - for console app that registers with server to subscribe to broadcasts
3) Agent.cs - class...
(Read More) A small Windows Application to show you how to play a wave (.wav) sound file. I am using the C# IDE from SharpDevelop and the runtime dotnetfx 1.1 from Microsoft, both free downloads. This forms a small and fast student system to write and debug C# programs. From there you can later graduate to...
(Read More) This simple static class contains a static method called sOnline that accepts a username as a string param. it make a call to an old yahoo api that will determine if a Y! user is online. This only returns true if the user is not using stealth, this will return false if a user is online but...
(Read More) Ever wanted to know how to implement running lights? well here is your chance to find out.
Open a new Forms application enlarge the Form a bit and drop a Panel and a Timer on it. Add the class ChasingLights to the solution, see code. Implement a form Load, panel Paint and Timer Tick event. See...
(Read More) A common question that routinely comes up is how to share data between forms.
I have outlined two common ways to pass data between forms, among many others. I have used a public property on the output form to accept a value and update the display. I also have a method accepting parameters from...
(Read More) The FileSystemWatcher class is phenomenally powerful—and staggeringly simple.
Start up a new Windows Forms application. Then drop FolderBrowserDialog, FileSystemWatcher, label, listbox, and button controls onto the form.
Setting up Properties:
Set up the name properties of the controls;...
(Read More) Start a new Forms application. Drop a Panel and a Timer control on it. Set up a Timer_Tick, Form_Load and a Panel_Paint eventhandler and fill in the code. Run the app and watch the string rotate.
(Read More) Quite a few people have been asking how they can get their applications to talk to each other. More specifically, they have been wanting to know how to access information from another running application using .NET Remoting.
Not having done this before, I decided to take up the challenge and...
(Read More) Use regular expressions, regex, to create an efficient textbox that only takes in digits as input.
(Read More) the code tries to export the table memberinfo to excel.
(Read More) Way back years ago I tried to understand delegates.
See the snippet how I did it.
(Read More) Here's I wrote some code to move controls on the form
1- Assign (Control_MouseMove, Control_MouseDown, and Control_MouseUp) to the controls you need it movable.
(Read More) Here's I wrote some code to say binding not means control and data from database, it may be class holds some data
(Read More) The Sort method of the List class sorts everything the default way : ascending.
You can use the Reverse method of this class to get what you want or you could implement the IComparer interface like in this snippet.
(Read More) This generates a random number string. I needed to post this code to link to it :P
(Read More) I wanted to make something for beginners, to show and easy way of creating and using a class and it's methods.
So here is a customer class, and a Console application that takes advantage of the class. It is mainly set, and get methods, with one or two extra methods you can play around with. It...
(Read More) I haven't really used Lists very much in the past so I wanted to mess around with them today and see if I could do anything that was neat.
In this snippet I create a list from a text file. In my case I used names of people I know. The program creates a list from the file using StreamReader. If...
(Read More) If you need to execute SQL Statements\Stored Procedures\UDFs which return\don't return results, Here I've developed this class to be used in Data Access Layer.
(Read More) Here's I wrote some code to validate user input without using if\else statements.
I believe in scalability is the most important aspect in our problems solution. Let's say we are required to permit only numerics in some text boxes; we shouldn't develop something like that if(((e.KeyChar < '0' ||...
(Read More) Here's I wrote some code to insert\retrieve images from SQL Server database
1- Create table to hold Image ID, Name and itself
USE
GO
/****** Object: Table . Script Date: 07/10/2009 23:46:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
(Read More) Here's I wrote some code to create login on SQL Server.
1- Add references (Microsoft.SqlServer.Smo, Microsoft.SqlServer.SqlEnum and Microsoft.SqlServer.ConnectionInfo) to your project.
2- Call method CreateLogin which takes to some arguments (documented)
(Read More) Here's I wrote some code to backup your database
1- Add references (Microsoft.SqlServer.Smo and Microsoft.SqlServer.ConnectionInfo) to your project.
2- Call method BackupDatabase which takes to arguments database name and backup file path with extension .bak (preferable)
(Read More) The matrix class in .NET is not a full featured matrix class as mathematicians would like to see it, still you can do amazing things with it.
Create a new windows form application.
Fill in the code and you are ready to experiment.
In the code I do something with a translate transform, but you...
(Read More) This is a query aggregator that stacks up queries and parameters until you hit the hard limit of 2010 set by the SQL Server/Driver, or you call .RunQuery()
Scott Knake
Custom Software
Apex Software
(Read More) three lines of code to check MS Excel is installed on PC
(Read More) Instead of creating a new folder in users application folder under program files and putting there some visible resources, embedding those resources to single executable is better. in this snippet i will show playing an embedded sound file.
(Read More) Shows how to create a simple 'Process Manager'. and control processes
(Read More) Sometimes you only want to enter numeric data in a textbox.
You have two options here :
Let a user type whatever he/she wants into a textbox, validate the input and show him or her an annoying message that he/she has done something wrong.:angry:
Or: capture the key before input, check if it's...
(Read More) I wanted to make an array of bits which I could click on and off at will. Sort of a register you could manipulate. First thing that came up was a checkbox control. But I wanted to change the usual checkmark with a 1 or a 0. With tips from JerryShaw and Ramy Marhous I came up with the following.
(Read More) This seems to come up every so often, so thought I would add it here so people can have a look if they search the site.
Reading and writing to a text file is a very basic thing in C#, most of us have to do it from very early on and several times later. It's not exactly secure (as you can...
(Read More) Although the DateTime structure in .NET has an IsLeapYear method. Lots of people in here like to do this on their own.
See this snippet on how it can be done. This is in C# but other language adepts might benefit from it also.
(Read More) Just a little snippet to check if a string contains only letters.
(Read More) Is it Mother Date and Father Time? Any way, getting all the different date and time displays working can be imperturbably perplexing at times. You take a look at it in this Windows Console Application.
(Read More) Blink and you will see them appear in a Console window.
This is a translation to C# of a Modula-2 implementation by N.Wirth, the inventor of Pascal. The tested integers are obtained by incrementing alternatively by 2 and 4, thereby avoiding multiples of 2 and 3 in the first place. This list starts...
(Read More)