27 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for thomasdoejr

Write a program using for loops to produce an R by C rectangle, where R and C are provided by the user. The following are the triangles for different values of R and C. R is the number of rows and C is the number of columns

Member Avatar for rproffitt
0
324
Member Avatar for DdoubleD

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 library that facilitates/eposes the interfaces for …

Member Avatar for HarishKJ
2
2K
Member Avatar for tinstaafl

This is a very simple login form. I set it up so that the form won't close until it's cancelled or a valid username and password are entered. I chained the check for the username and the check for the password, so that if the username doesn't pass the password …

Member Avatar for tinstaafl
0
7K
Member Avatar for xrjf

By means of Mates8, graph coding becomes a bit easier. The web page has four textboxes so the figure gets bounded to the left, right, top and bottom; and a draw button. Additionally, a panel control will contain the image generated by the code after the button is pressed.

Member Avatar for xrjf
0
563
Member Avatar for rafaelbelliard

This simple but extremely useful trick explains how to hande a radiobutton within an ASP.NET gridview, without having to fiddle around with the sometimes cumbersome beast that javascript is. To avoid postbacks, we'll be using ASP.NET AJAX's updatepanel. Basically, the logic is grabbing the sender (ie, the radiobutton checked), disabling …

Member Avatar for h4ng4r18
1
588
Member Avatar for vishalrane

[CODE]<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CheckCode.aspx.cs" Inherits="CheckCode" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Verification code to prevent auto signup in ASP.NET 2.0</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } a:link { color: #0000FF; } a:visited { …

Member Avatar for yusuf_3
1
769
Member Avatar for xrjf

The days when the calculator had almost 3 thousand visits a day have gone. Since then, there have been several major versions and lots of minor versions. Somehow, I feel pleased in that the present core algorithm follows the rules of the first I read; of course, extending the simplicity …

0
399
Member Avatar for tinstaafl

Here's a simple wrapper for printing text. Built as a class library, this can be used in any .net application. This has automatic word wrapping. I figured that using the new constructor to accept different parameters would easily allow for printing different documents with different settings. I included Name, Font, …

1
577
Member Avatar for nakor77

This snippet will allow you to easily work with session variables in your applications. This example is using a string type but it works the same for any data type, you would just need to change the default return value from string.Empty to something more appropriate.

Member Avatar for LastMitch
0
215
Member Avatar for tinstaafl

In a recent discussion these code snippets were developed to replace Convert.ToInt32 and Convert.ToDouble. The person I was helping had a very large number of conversions to do. In our tests, using these 2 routines we were able to do over 1 million conversions in less than half the time. …

1
143
Member Avatar for vishalrane

All the webpage data will be converted into PDF file, You can also add details such as ur name etc by using Chunk chunk1 = new Chunk("By Vishal RAne, [email]vishalrane50@example.com[/email] \n",FontFactory.GetFont("Verdana", 8)); The pdf will be saved on desktop.... u can change location by using PdfWriter.GetInstance(Doc, new FileStream(Environment.GetFolderPath (Environment.SpecialFolder.Desktop)+ "\\VishalRane.pdf", …

Member Avatar for SummiRS
1
329
Member Avatar for gameon
0
122
Member Avatar for pinkygirl
Member Avatar for serkan sendur

To make some operations on XML elements you have to know their types. This snippet is about getting the types of these elements.

Member Avatar for deepalijain
0
234
Member Avatar for tlox

Hello everyone. i have a student database, from which i search a student by entering the student ID at the web interface.Im using a repeater to display search results. Within this repeater i have a link button that should redirect to a page that will display full information about the …

Member Avatar for asemoonabi
0
2K
Member Avatar for G_Waddell

Hi I thought I'd share this with you all as it is really quite simple but I spent ages looking for it. I have an ASP.Net App with a master page containing a tree view that holds a heirarchy of data (as opposed to site naviagation) What I wanted was …

0
634
Member Avatar for pinkygirl

Hello. This demo shows how to upload multiple image files, saving them in "Image" folder and displaying them all. To do this, create a folder named "Image" in your solution explorer. I hope you like it :)

0
682
Member Avatar for nirveshverma

hey buddies:) here is login page for begining purpose in asp.net i hope you will enjoy it and it is expected there is some mistakes also so please feedback it. Thanks

Member Avatar for umamahesh2020
0
153
Member Avatar for Krstevski

Hello friends, I wrote a simple class for string validation and now I want to share with you. The class contains: - Constructor(s) public Validator() public Validator(string text) - Properties private string strText = string.Empty; - Method(s) public bool isNullOrEmpty() public bool isNullOrEmpty(string str) public bool isLengthMax(int maxLength) public bool …

Member Avatar for Momerath
1
239
Member Avatar for ApocDen

1. Imports System.IO 2. Create class "CreateThumbnails" or any class and place following function inside that class You need one function to response call back to main function Function ImageAbortDummyCallback() As Boolean Return False End Function

0
501
Member Avatar for sohil.shivani

Hello sir, I tried with this code it is running well but I am not getting mail in my account with this code, even this code is not giving any error. Is there any problem?? Please help me.

0
449
Member Avatar for murugavel.b

If you want to restrict the user to go back or forward from the web browser, you can use the below mentioned javascript. Use this javascript in the script tag. It works on all browsers. For further details: [url]http://dotnetbypulikesi.blogspot.com[/url]

1
186
Member Avatar for DdoubleD

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 …

Member Avatar for ddanbe
2
1K
Member Avatar for Ramesh S

Sometimes you might need to have checkboxes for each row in a GridView control (like Inbox in Gmail). This code snippet helps to select/unselect all checkboxes in the GridView control by clicking the header checkbox. The selectUnselectCheckboxes() javascript function handles this fuctionality. This function is called in the CheckBox in …

0
315
Member Avatar for Shalvin
0
133
Member Avatar for Shalvin

aspnet_regsql is a tool user for installing membership, role and personalization tables to Sql Server. 1. Porting all tables to Sql Server 2. Porting only membership tables to Sql Server 3. Removing all membership and role tables 4. Removing Personalization tables. I am be posting a detailed blog on Membership …

0
146
Member Avatar for Shalvin

Web site Administration Tool is accessible only from the hosting server. Many times programmers won't have direct access to the the hosting server. So knowledge of ASP.Net Membership classes is an added advantage in creating an administrative module for the site. In this code snippet we will take up: 1. …

0
101

The End.