본문 바로가기

VB.net & WPF & C#

Easily Add a Ribbon into a WinForms Application (C#) Style 2007 Style 2010 Style 2013 http://www.codeproject.com/Articles/364272/Easily-Add-a-Ribbon-into-a-WinForms-Application-Cs (built in VisualStudio 2015) 더보기
C# LoadingCircle IntroductionWhen it's time to wait, we are used to seeing the classic blue progress bar. It is everywhere in Windows and many other applications. However, animations are getting more and more popular.For example, when Firefox loads a page, a small spinning circle appears and shows you that the page is loading. Moreover, Microsoft also uses this kind of animation in the Windows Media Center, Enca.. 더보기
vb.net simple Parallel & Thread example Imports System.Threading Imports System.Threading.Tasks Public Class Form1 ' Private Queue1 As New Queue(Of String()) Private cts As New CancellationTokenSource() Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Btn1.Click If Btn1.Text.Contains("Start") Then QueueList.Add(New Queue(Of String())) Dim P_W As WaitCallback = New WaitCallback(AddressOf producer) Dim C_W1 As WaitCal.. 더보기
Data Parallelism ' Sequential version For Each item In sourceCollection Process(item) Next ' Parallel equivalent Parallel.ForEach(sourceCollection, Sub(item) Process(item))VB.net // Sequential version foreach (var item in sourceCollection) { Process(item); } // Parallel equivalent Parallel.ForEach(sourceCollection, item => Process(item));C# 더보기
Producer & Consumer Model - use Queue, Threadpool Imports System.Threading Public Class Form1 Private Queue1 As New Queue(Of String()) Private cts As New CancellationTokenSource() Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If Button1.Text.Contains("Start") Then Dim w1 As WaitCallback = New WaitCallback(AddressOf producer) Dim w2 As WaitCallback = New WaitCallback(AddressOf consumer) Dim w3 As WaitCallback .. 더보기
How to select multiple controls by mouse-dragging over them C#namespace WindowsFormsApplication5 { using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; /// /// Main application form /// public partial class Form1 : Form { /// /// Initializes a new instance of the WindowsFormsApplication5.Form1 .. 더보기
CSharpCodeProvider Class : Runtime Script Compile Imports SystemImports System.IO Imports System.Globalization Imports System.CodeDom.Compiler Imports System.Text Imports Microsoft.CSharp Imports Microsoft.VisualBasic Namespace CodeProviders Class CompileSample _ Public Shared Sub Main(args() As String) If args.Length > 0 ' First parameter is the source file name. If File.Exists(args(0)) CompileExecutable(args(0)) Else Console.WriteLine("Input .. 더보기
Yet another thread-safe blocking queue for .NET ( producer - consumer) Yet another thread-safe blocking queue for .NETOn one of my projects I needed to have a concurrent queue with multiple producers and multiple consumers. Unfortunately, .NET 3.5 doesn't yet have a blocking queue, and Google didn't turn up anything that quite fit the bill, so I wrote my own. This solution is a simple one based on monitor waiting. When a consumer thread is dequeuing an item, one is.. 더보기
OrdinalIgnoreCase Property - 문자비교시 대소문자 처리 옵션 ' This code example demonstrates members of the System.StringComparer class. Imports System Imports System.Collections Imports System.Collections.Generic Imports System.Globalization Imports System.Threading Class Sample Public Shared Sub Main() ' Create a list of string. Dim list As New List(Of String) ' Get the tr-TR (Turkish-Turkey) culture. Dim turkish As New CultureInfo("tr-TR") ' Get the c.. 더보기
VB.net Parsing XML Parsing XML with XmlDocument Imports System.IO Imports System.Xml Module ParsingUsingXmlDocument Sub Main() Try Dim m_xmld As XmlDocument Dim m_nodelist As XmlNodeList Dim m_node As XmlNode 'Create the XML Document m_xmld = New XmlDocument() 'Load the Xml file m_xmld.Load("C:\CMS\Personal\family.xml") 'Get the list of name nodes m_nodelist = m_xmld.SelectNodes("/family/name") 'Loop through the n.. 더보기