New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of .Net
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate(Application.StartupPath)
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim MyYoutube As New YTEngine
        MyYoutube.YT_StartProcessing(TextBox1.Text)
        PictureBox1.ImageLocation = MyYoutube.YT_Return_Video_Thumbnail
        PictureBox1.Tag = MyYoutube.YT_Return_Titled_Download_URL
        PictureBox1.Name = MyYoutube.YT_Return_Video_Title + ".flv"
August 28, 2010 @ 10:28pm
29 Views
no comments
 
C#
/// <summary>
/// Returns the content of the POST buffer as string
/// </summary>
/// <returns></returns>
public static string FormBufferToString()
{
    HttpRequest Request = HttpContext.Current.Request;            
 
    if (Request.TotalBytes > 0)            
        return Encoding.Default.GetString(Request.BinaryRead(Request.TotalBytes));
by Rick Strahl   August 19, 2010 @ 2:39pm
15 Views
no comments
 
C#
 
// la la la
if (foo is ISomeInterface) {
    ((ISomeInterface)foo).SomeMethod();
}
else if (foo is ISomeOtherInterface) {
    ((ISomeOtherInterface)foo).SomeMethod();
}
else {
    throw new SomeException();
by InfinitiesLoop   August 09, 2010 @ 4:26pm
121 Views
2 comments
 
' I watched Karl's video about validation with custom rules, and wondered
' why Silverlight, ASP.NET and ASP.NET MVC had DataAnnotations, and
' WPF only had IDataErrorInfo. So I thought of using EF4 as the model,
' and generating a metadata class like in RIA, MVC, etc for WPF and a
' inheritable generic class to convert the validations between IDataErrorInfo
' and the DataAnnotation attributes. 
'
' This way validation can happen the same way for each type of client!
'
' Let me know what you think please?
by rickrat   July 02, 2010 @ 3:54am
88 Views
no comments
 
Dim fc As New System.Drawing.Text.InstalledFontCollection
Fonts = (From x In Enumerable.Range(0, fc.Families.Count) _
         Select New With {.Id = x + 1, _
                          .Name = fc.Families(x).Name, _
                          .SortOrder = (x + 1) * 100}).ToList
fc = Nothing
by Thom Lamb   June 30, 2010 @ 10:54am
Tags: .Net, VB, Fonts, Linq
31 Views
no comments
 
 
Imports System.Net
Imports System.Net.NetworkInformation
Imports System.Threading
Imports System.Text
 
Public Class Form1
 
    Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click
        MemoEdit1.Text = ""
by Thom Lamb   June 25, 2010 @ 10:13am
Tags: .Net, VB. Ping
34 Views
no comments
 
' Import ...
 
Public Module EnvironmentEvents
 
' Autogenerated code ...
 
    Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
        If (DTE.ToolWindows.ErrorList.ErrorItems.Count = 0) Then
            SelectRootNode()
            DTE.ExecuteCommand("TestDriven.NET.RunTests")
by Dennis Traub   June 17, 2010 @ 9:40pm
59 Views
no comments
 
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated from a template.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
 
Option Compare Binary
by rickrat   June 13, 2010 @ 4:51pm
64 Views
no comments
 
Try
 
    Habanero.Base.GlobalRegistry.ApplicationName = "IGD"
    Habanero.Base.GlobalRegistry.ApplicationVersion = "v1.0"
    HabaneroApplication = New Habanero.UI.Win.HabaneroAppWin(Habanero.Base.GlobalRegistry.ApplicationName, Habanero.Base.GlobalRegistry.ApplicationVersion)
    HabaneroApplication.ClassDefsXml = IGD.BO.BOBroker.GetClassDefsXml()
 
    If Not HabaneroApplication.Startup() Then
        Throw New Exception("Unable to start Habanero Application")
    End If
by Mitchell William Cooper   May 30, 2010 @ 2:57pm
Tags: Habanero, ASP.NET,
43 Views
no comments
 
C#
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    Response.Write(DropDownList1.SelectedValue);
}
 
protected void ButtonSave_Click(object sender, EventArgs e)
{
    int n = SqlDataSource1.Insert();
    if (n == 1)
    Response.Redirect("ViewGuestBook.aspx");
May 14, 2010 @ 12:16am
Tags: ASP.net
37 Views
no comments
 
C#
public interface ICriteriaQuery<TEntity>
{
    DetachedCriteria Criteria { get; }
}
 
public interface ILinqQuery<TEntity>
{
    Expression<Func<TEntity, bool>> Expression { get; }
}
by Liam   May 13, 2010 @ 10:40pm
77 Views
no comments
 
C#
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector)
{
    return source.Distinct(new SelectorEqualityComparer<TSource, TKey>(selector));
}
by Paulo Morgado   April 10, 2010 @ 5:22am
85 Views
no comments
 
C#
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, bool> predicate)
{
    return source.Distinct(new PredicateEqualityComparer<TSource>(predicate));
}
by Paulo Morgado   April 10, 2010 @ 5:21am
89 Views
no comments
 
C#
[Serializable]
public class SelectorEqualityComparer<TSource, Tkey> : EqualityComparer<TSource>
{
    private Func<TSource, Tkey> selector;
 
    public SelectorEqualityComparer(Func<TSource, Tkey> selector)
        : base()
    {
        this.selector = selector;
    }
by Paulo Morgado   April 10, 2010 @ 5:18am
Tags: C#, .NET, .NET35, .NET40
94 Views
no comments
 
C#
[Serializable]
public class PredicateEqualityComparer<T> : EqualityComparer<T>
{
    private Func<T, T, bool> predicate;
 
    public PredicateEqualityComparer(Func<T, T, bool> predicate)
        : base()
    {
        this.predicate = predicate;
    }
by Paulo Morgado   April 10, 2010 @ 5:12am
Tags: C#, .NET, .NET35, .NET40
61 Views
no comments
 
C#
using System;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Routing;
 
namespace MvcSamples.Html
{
    public static class UrlExtensions
by Bobby Diaz   April 08, 2010 @ 10:10pm
Tags: ASP.NET, MVC 2
281 Views
1 comments
 
C#
 
/*

Author: Mohammad Azam 
http://www.highoncoding.com 

This is a much better version than I demonstrated in the screencast! 

*/
by Mohammad Azam   March 29, 2010 @ 11:51am
221 Views
no comments
 
{
   "Fields":[
      {
         "FieldName":"Name",
         "ReplaceValidationMessageContents":true,
         "ValidationMessageId":"Name_validationMessage",
         "ValidationRules":[
            {
               "ErrorMessage":"Meno musí mať 5 až 40 znakov.",
               "ValidationParameters":{
by Jozef Izso   March 09, 2010 @ 7:37am
Tags: asp.net, mvc
147 Views
no comments
 
C#
//Classe I want to resolve from ILogger but want to register
public class AdvancedLogger : ILogger, IRequired
    {
    }
 
public class OtherClass : IOtherInterface, IRequired
    {
    }
 
by Thomas Jaskula   March 04, 2010 @ 2:00pm
55 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
 
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Data;
by Matt Slay   March 03, 2010 @ 12:56pm
79 Views
no comments
 
C#
public class URLRewriterModule : IHttpModule
    {
        /// <summary>
        /// You will need to configure this module in the web.config file of your
        /// web and register it with IIS before being able to use it. For more information
        /// see the following link: http://go.microsoft.com/?linkid=8101007
        /// </summary>
        #region IHttpModule Members
 
        public void Dispose()
by ZeroDotNet   February 22, 2010 @ 11:04pm
83 Views
no comments
 
XML
  <Target Name="AfterMerge">
  <ItemGroup>
    <JsFiles Include="$(TempBuildDir)\Scripts\infinitecarousel.js;$(TempBuildDir)\Scripts\jquery.autocomplete.js;$(TempBuildDir)\Scripts\core.js"/>
    <CssFiles Include="$(TempBuildDir)\Content\reset.css;$(TempBuildDir)\Content\infinitecarousel.css;$(TempBuildDir)\Content\Site.css" />
  </ItemGroup>
    
  <ReadLinesFromFile File="%(JsFiles.Identity)">
    <Output TaskParameter="Lines" 
            ItemName="jsLines"/>
  </ReadLinesFromFile>
by ArranM   February 16, 2010 @ 2:25pm
567 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Text.RegularExpressions;
using System.Reflection;
using Activity_Search.Code;
 
namespace Activity_Search.Controllers
February 09, 2010 @ 5:31am
99 Views
no comments
 
    /// <summary>
    /// Extension methods on HtmlHelper and UrlHelper that provide strongly-typed access to URLs and ActionLinks for AccountController actions
    /// </summary>
    public static class HelperExtensionsForAccountController
    {
        /// <summary>
        /// Html Helpers for Controller = Account
        /// </summary>
        public static AccountControllerActionLinks Account(this HtmlHelper htmlHelper)
        {
by Ian   February 07, 2010 @ 7:29pm
410 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Security;
using System.Security.Permissions;
using System.IO;
using System.Security.Policy;
by bnaya   February 05, 2010 @ 11:40am
51 Views
no comments
 
brought to you by:
West Wind Techologies


If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate