c#

.NET Core is the Future

According to Microsoft's development blogs, .NET 5 will be the next release name after .NET Core 3.x.

Enable or Disable WPF DataGrid Context Menu Item

Here is an example of how to set WPF DataGrid Context Menu items Enable/Disable status, using Context Menu Opening event.

WPF ComboBox Does NOT Have a Right Item Selected When Initialized

Sometimes even we set all done (Set data binding correctly) for a ComboBox for in WPF, but the ComboBox can not still show current item but just an empty selection.

Blazor 123

Base information of Blazor

Blazor is a single-page app framework for building interactive client-side Web apps with .NET. Blazor uses open web standards without plugins or code transpilation. Blazor works in all modern web browsers, including mobile browsers. (from Microsoft ASP.NET Website)

What is the Difference between a struct in C# and C++?

The main difference between Struct in C# and C++ is that a Struct in C# is a Value Type but it is a Reference Type in C++.

Marshalling C++ struct in C#

We have a WPF project that needs to communicate with a C++ project via TCP/IP socket (Winsocket). WPF project requests data from C++ project and C++ project send its data from some C++ structs.

ComboBox Data Binding to an Enum in WPF

There is a little trick when a ComboBox binds to an Enum in WPF. Here we collect 3 ways.

Generic Type in WPF Custom Control is Limited by XAML

We tried to use Generic type in a WPF custom control, but later we realized WPF Xaml does not support generic type well, so either we use another non-generic class to wrap the custom control, or avoid using generic type in WPF custom control.

WPF GroupBox Header StringFormat Binding

When you try to use StringFormat binding for a GroupBox Header in WPF, you might find it does not work! Some people mentioned there is a HeaderStringFormat but not StringFormat, but at least in .NET 4.5, we can not find out a HeaderStringFormat.

Microsoft’s Help Document Websites

Microsoft has MSDN their online document resources and they have been there for many years. But, in 2016, Microsoft released a new document platform which is docs.microsoft.com, the at that time the new document website was still preview version.

Using the Bing Map REST Service with .NET (simple notes)

I had a chance to learn a little bit Microsoft Bing Map Development Knowledge when a friend visited. Let me record something which we talked about (actually I learnt)

Smart Amazon Fillers Website Supports Both of Canada and USA Now

Since I met another weekend and got spare time, I did not wait long and finished urgent features on Smart Amazon Fillers website: Supporting multiple countries, and fixing pagination issue.

The Amazon Filler Items Searching Website is Upgraded

I released a simple ASP.NET MVC website using Amazon service 2 days ago. I might call it MyFiller project version 1. In the 1st version, I actually have not finished all features which I wanted. So in past 2 days, I modified something on it. Now I can call it version 2.

DO NOT Save Password in Web.Config or App.Config Directly

We saved passwords in project config file normally when we developed the project, However, it should be different when you deploy your project since most of time you should avoid your customer to touch some system passwords such as the database connection password, some of your API’s passwords such as Google+ API secret codes;

Experienced Software Developer Still Faces to Code or Basic Acknowledge Test When Interview

As a IT guy, a Software Developer, a Microsoft technologies developer (from C++ to .NET ) with over 24 years development history, I still have to face to some awkward (embarrassed ? ) situations such as job interviews. I left school so many years, but some interviews still needed me to give correct answers for some basic computer and programming acknowledges, such as: What is C# ? What features does OO have ? or I was asked for writing code to give a good performance program to implement a scanning or searching case based on stack or queue ….

Microsoft Signed Agreement to Acquire Xamarin

I just read the BIG and GREAT news to all Microsoft technologies developers this morning. But I read it some lately: Microsoft has signed an agreement to acquire Xamarin !! This is really an existing news, and it happened 2 days ago (actually less than 48 hours ago).

How to disable Progress bar’s animation in .NET

The Windows Forms progress bar control comes with re-draw bar function by default, you will see the drawing process from left to right when you have one or multiple progress bar controls on your screen.

Mono Supports ASP.NET 4.x Partially

I was some confused on Mono project official site information: I had question about what .NET web technologies which Mono supported. I got information that Mono currently ONLY supported ASP.NET 2 from official content here.

Using AnkhSVN to Add a new project on SVN Server

I have introduced AnkhSVN, which is a SVN plugin for Visual Studio. But I just realized I never gave some real steps which about how I used this plugin.

C# Get Application Path

I tried to use the traditional way to get an Windows form application path:

Windows Forms Listview Control Columns Header not Shown

When you use Windows Form Listview control, you will see a strange problem: you added columns, but the columns can not showing up in the designer panel in Visual Studio.

WPF and Windows Form Integration Application Localization

We have a Windows From application to load WPF modules, due to Microsoft programming guide, they called this kind of application as WPF and Windows Form integration application.

A Scada System Desktop Client

This is a client of a Scada system. It is a WPF windows application (built in 2014).

Something about C# Programming

Here I collected some content which I noted for C# programming, the content might be from either recent learning courses, or from my real cases in some years ago, but please know the content might not for everybody who are reading this post, mostly, the content might be for myself, a personal notes.

A System Editor module in a Scada System using WPF part 2

This is the part 2 of the WPF applicatoin, the Part 1 is here:

A System Editor module in a Scada System using WPF Part1

Let's start to introduce the new System Editors module in a Coal Minding Scada system.

Conspec Windows Primary System S950 Part 1

Windows Primary System is a Coal Mine gas detection device control system which provided Conspec Controls.

Creating Own Code Snippet in Visual Studio

You can create your own code snippet in Visual Studio for fast inputting.

C# Standard Date and Time Format Strings

The following is Standard Date and Time to String Format Strings sample:

Single WPF Application Instance

How we force to run only one instance of our WPF application ?

A Simulator Program Using WPF

This simulator program was for simulating a special company devices, which are for Coal Mine field gas detection.

Windows Form FlowLayoutPanel Memory Leak ?

There were not only one time, and there were lots of programmer who used Windows Form FlowLayoutPanel control got the memory leak issues.

Event, Custom Event and Generic Event in .NET

We often need to implement events in our own class. About how to implement events, Microsoft provides tutorials such as this one.

Linq To Objects vs Linq To Entities vs Entity Framework

There are some articles in the internet confused the concepts among Linq to Objects, Linq to Entities and even ADO.NET Entity Framework, they often mentioned Linq To Objects and Linq to Entity or Entity Framwork are the same ting. But they ARE NOT the same.

Nesting Try Catch Exception In C#

In some cases you can use nesting Try…Catch exception handling:

Windows Form Application Stopped Working Due to Problem Event Name CLR20r3

There was a windows forms application based on .NET 4.0 and Visual Studio 2010, it was working well on a PC which we developed it on, but after we moved its debug folder that includes generated executable files, it crashed (We used Windows 7):

WPF The calling thread must be STA

In a multithread WPF project, we got program crash, but actually WPF did not give us any help or error information on the screen, then we tried to debug using steps, finally we got the following error information on a line of code with adding related variable in this line of code into Watch window:

Big-endian and Little-endian and BitConverter

About Big endian and Little endian explanation, please read the following content from Microsoft:

ConfigurationManager in Windows Form using Visual Studio 2010

When you create a new Windows Forms application in Visual Studio 2010, and if you want to do something related config file, normally you will use ConfigurationManager namespace, for example:

Cannot open include file ‘fstream.h' in Visual Studio 2010

There is a C++ project which is migrated from old VC++ 6.0, We use Visual Studio 2010 now.

ADO.NET connected mode vs disconnected mode

ADO.NET can work on either connected mode or disconnected mode.

DataSet vs DataReader

DataSet is an in-memory representation of a database, providing a consistent relational programming model no matter what format of data source. It contains multiple data tables and their relationship and constraints information.

Start to Develop Bing Map Application (2)

We have finished the first step: Apply a Bing map key to develop Bing map application.

Start to Develop Bing Map Application

Even you are an experienced Bing map developer, you still might forget how to start to develop a Bing map application after some time if you no more touch the Bing map stuff. So here we record some initial tings for Bing map development.

A Helpful .NET Garbage Collection Article in Chinese

We found a nice article about .NET Garbage Collection, but it is in Chinese:

Microsoft Chart Control Overflow Error After Several Times of Zoom In

If you use Microsoft Chart Control in your Windows Form Application and add the function of zoom in and zoom out, you have to care about the initial and Axis data settings, if you did not set correctly, you might get some errors, the following is the one of multiple errors:

Custom Microsoft Chart Control Zoom Reset Button

After you zoom in the Microsoft Chart control. you will see X scroll bar and Y scroll bar which you can scroll the view. Also, you can see two small icons beside the scroll arrow button on scroll bars, the one is on X scroll bar, another one is on Y scroll bar. They are zoom reset buttons.

Program has stopped working with APPCRASH

Our program got an error in some case, and the windows 7 pops up the following window:

Force Windows Forms Application to Run As Administrator on Windows 7

If you are using Windows 7 or Windows Vista, or Windows Server 2008, you should know the UAC (User Account Control), this is one of significant differences between Windows XP and the newer Windows System.

Seconds to hh mm ss in C#

How to convert seconds number to a string using format “hh:mm: ss”?

Accessing a member causes a runtime error exception because marchal by reference class

Sometimes in your code you might see a warning like following:

FileStream Cannot Access File Because Used by Another Process

We have a FileStream code using new FileStream:

Convert Percentage String to Double

If you have a percentage string and you want to convert it to a number type, like double. Here we have a sample:

Form.DialogResult Does Not Call Close Method Automatically

When we use Form.DialogResult in our Windows Form project, we should know it just return a DialogResult, it does NOT call a Close method to close the form automatically. Even you click the Close icon in the top-right corner of the form to close the form.

Check Control Information by Mouse Hovers

When you move your mouse point on the screen, there are some information can be shown when you hover a control.

A Problem when Dynamically Switch .rdlc in ReportViewer

Normally in a Windows Form project, you have multiple .rdlc template files. You can use a single ReportViewer control to dynamically bind the report file to multiple .rdlc files dynamically.

Add Registry Key and Value into a Setup Project

We have a case to create a Setup project for a Windows Forms project in the Visual Studio 2010, we need to write registry key and value when user install our software.

How to repeat table header on every page in RDLC report ?

When you build a .RDLC report in Visual Studio 2010 just like following one, you will see the table header can not repeat on every page when you change pages.

Arrow keys can not be captured in KeyDown event ?

In Windows Forms, If you write a KeyDown event method for some keys, such as arrow keys, you might find it doesn't work, but for other keys like A,B,C,D… it work.

Scrolling Stuck in Microsoft Chart Control

We have a windows form project which used Microsoft Chart Control. The Axis X is DateTime type, Axis Y are double values.

Determine A Variable is Double.NaN ?

How do you determine a double variable is Double.NaN ?

Thread.Abort and Thread.Join

There was no Thread.Join method in .NET 1.1, it is only available in .NET 2.0 and later.

Custom Renderer for ToolStrip Control

“You can achieve completely custom appearance and behavior by setting either the ToolStrip.Renderer property or the ToolStripManager.Renderer property to a custom renderer.” – From Microsoft.

Hello World Example in Different Languages

If you are learning C, C++ or even Java, the first code example might be similar, they are all a example named Hello World.

Object reference not set to an instance of an object in resx resource file

We have a Windows Forms solution which includes multiple sub projects, and since long time, we used Visual Studio 2005, and then 2008, now we are using Visual Studio 2010 to develop this solution.

Resource file .resx compile error in 64-bit Windows 7

We have a project which can be built on Windows XP and Windows 7 32-bit, But when we moved it to a Windows 7 64-bit PC, We got the following compile error in Visual Studio 2010:

OLE Automation date

From Microsoft :

encountered a problem and needs to close

http://stackoverflow.com/questions/1680663/disable-foo-has-encountered-a-problem-and-needs-to-close-window

Calculate how many days (hours, seconds...) between 2 DateTime values

Here we have example code:

About Memory Management in .NET

Today I give a topic which maybe most of us are interested in it, no matter you are a C++ or C# programmer, or even you are not a programmer, it is from the following questions which most of us always asked:

Override vs Overload

Here is a nice article about Overload vs Overriding:

A nice computer programming notes website

A nice computer programming notes website, the author recorded lots of experience and notes from his projects, which is very good reference site for other programmers.

Remove an item from a List

In some cases, if you want to remove an item from a List in C#, you can not use foreach and remove the item, because if you remove one item, the original list has changed, the foreach loop can not work correctly.

About update dataset for a .RDLC file in Visual Studio 2010

In Visual Studio 2010, if you open a report template file .rdlc. sometimes you might realize you can not update dataset if your data source is changed.

VS 2010 Bug ! MS ReportViewer with Nested Objects Data Sources

There is a big bug in Visual Studio 2010 if you use MS ReportViewer and .rdlc file with Nested Objects Data Sources.

Microsoft Reporter notes 1

1: ReportViewer Control in Visual Studio 2010 author website ?

XML to memory file

Here is a sample about XML and memory file:

Handle Keyboard Input at the Form Level and Control Level

When you handle keyboard input in Windows Form, you have to control them in at least two level: Form level and Control level.

How to use Symbol Factory .NET

Symbol Factory .NET is a .NET software component which is produced by Software Toolbox Inc., and which used for adding animated objects from a library of over 3,600 industrial and manufacturing objects into your Visual Studio.NET software applications.

C# Transaction for SQL Server

ComboBox in Windows Form using KeyValuePairs

The ComboBox in Windows Form is not like the same control in Web Form, it can not insert a Key and Value pair directly.

Microsoft Colors list for .NET

.NET programmers always need the Color values, numbers, names, and also maybe they want to see what the color show if see the color name.

Get Local Computer Name in C#

Here we got 4 ways to get local computer name:

Most Popular Programming Languages in 2010

TIOBE has released the 2010 report of Programming Languages index in January 2011.

ConfigurationManager can not be found in .NET 2.0 ?

When we added something such as database Connection String in App.config file in .Net 2.0, we need to use the following 2 ways to get Connection String:

Display image using PictureBox and ImageList in C# ( Windows Form )

The regular way to display image in a Windows Form is using PictureBox.

Microsoft Official C# Learn Videos

Microsoft provides lots of learning videos.

Check if Bit is set, Set Bit to 1 or 0

1: Check if Bit is set

How to install an assembly into the Global Assembly Cache in Visual C#

1: How to install an assembly into the Global Assembly Cache in Visual C#

3 methods in C# to get List.FindAll

How do you have the code to Find something from a List?

Get Application Path in Web App and Window App (.NET)

Windows Application:

About memory mapping file

1: Microsoft MapViewOfFile function;

DLL using shared MFC DLL vs DLL with MFC statically linked

When you create a MFC library project using Visual Studio 2010, you will see the following screen to ask you choose a DLL type, so you might be confused by the following 2 options:

Mouse hover to select a row form ListView

On a ListView you can add this functionality directly on the row, something like this:

Convert VB to C# or C# to VB online

Telerik provides a online Convert VB to C# or C# to VB tool: online Convert VB to C# or C# to VB

Convert latitude and longitude to double values

How to convert latitude and longitude like below values to double values ?

A nice XMLSerialize sample using C#

The code sample is from the book "C# Design and Development: Expert One on One":

A sample using union in C

This sample code is for testing some data type border value using C union. Worked on Linux OS.

How C# rounds decimal numbers

You might have known the following example:

Data Type Suffixes (Numeric Literals) in C#

Maybe you need to check .NET Data Type Suffixes, or call it Numeric Literals.

System.AccessViolationException Attempted to read or write protected memory ?

A common error always pop up when you run your .NET Application just like the following :

C# lock Statement

The lock keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is released.

How to change all tab pages's title for a TabControl using C# ?

In some cases such as Multiple languages dynamically switching and if you have a main TabControl with some sub tab pages will be dynamically added into it, you might find it is not easy if you want to change all these dynamic tab pages.

Create SQL Server Database using C#

Here is a sample from codeproject :

List enum item names using C#

Assume you have define an enum like:


asp.net (148) c# (105) .net (96) silverlight (62) sql server (60) visual studio (57) wpf (56) Web (53) Windows (51) sql (43) microsoft (40) cloud (38) wcf (35) mvc (27) windows forms (23) azure (19) computer (19) source control (17) c++ (16) iis (16) javascript (15) c (15) git (14) database (14) WordPress (13) mobile (13) map (13) report (12) Blog (10) gis (10) linux (10) php (9) svn (9) css (8) google (7) system (7) jquery (7) html (6) web api (6) windows phone (6) gmail (5) open source (5) java (5) bing map (5) membership (4) .net core (4) blazor (4) Virtual Machine (4) windows server (4) system management (4) html5 (4) amazon (4) vmware (4) control (4) cpu (3) static (3) bootstrap (3) storage (3) binding (3) news (3) network (3) modbus (3) windows 7 (3) signalr (3) linq (3) chart (3) bing (3) eclipse (3) api (3) security (3) virus (3) job (3) iot (3) youtube (3) mono (3) setup (2) Skype (2) driver (2) xml (2) vb.net (2) cellphone (2) uml (2) VB (2) singleton (2) core (2) entity framework (2) WebAssembly (2) socket (2) data (2) development (2) cross platform (2) Router (2) server (2) programming (2) game (2) xbox (2) phone (2) visio (2) ado.net (2) ssd (2) angularjs (2) animation (2) video (2) interview (2) tools (2) permission (2) xamarin (2) kinect (1) size (1) install (1) print (1) grant (1) power (1) page (1) web app (1) printer (1) monitor (1) jave (1) wp7 (1) apps (1) office (1) dell (1) font (1) windows.form (1) vista (1) xp (1) ce (1) compact (1) object (1) hosting (1) Micorosoft (1) sdk (1) hot key (1) rss (1) combobox (1) gps (1) mobille (1) chrome (1) firefox (1) ie (1) embedded (1) media-player (1) firewall (1) GAC (1) browser (1) Memory (1) mfc (1) memebership (1) image (1) desktop (1) theme (1) tcp (1) client (1) Website (1) screen (1) tablet (1) ai (1) enum (1) esri (1) home (1) WiFi (1) Powerline (1) Internet (1) postgresql (1) Scada (1) email (1) life (1) Code (1) web socket (1) iis express (1) windows-8 (1) event (1) Cell phone (1) design (1) thread (1) mysql (1) editor (1) sql.server (1) msdn (1) shared (1) reset (1) share (1) document (1) help (1) android (1) iphone (1) it (1) threat (1) software (1) restful (1) deals (1) deal (1) angular (1) free shipping (1) ajax (1) iquery (1) tfs (1) config (1) password (1) 3d (1) maya (1) mel (1) rendering (1) agile (1) software development (1) hyper-v (1) linkedin (1) social (1) HDD (1) tekton (1) account (1) schduler (1) architecture (1) solution (1) seo (1)