Thursday, June 30, 2022

event - more details

event - more details

  1. C# Events - Creating and Consuming Events in Your Application
  2. In this video, I am going to introduce you to events and walk you through creating your own events. We will also discuss the features we can take advantage of and what best practices are that we should know about.

  3. Delegates in C# - A practical demonstration, including Action and Func
  4. Delegates in C# are really powerful, but most people don't know how to use them effectively, if at all. Today I am going to show you what delegates are, how to use them, why they are useful, and really how to take your code to the next level. Along the way, I will cover the special types of delegates named Func and Action. Now if all these new words seem intimidating, don't worry. This topic is actually really simple at its foundation. Yes, you can do some complex things with delegates, but an actual delegate is absolutely simple.

  5. C# Events and Delegates Made Simple | Mosh
  6. Are you confused about events and delegates in C#? Watch this tutorial and your confusion will be gone in 30 minutes!

    Event - continued

  7. Asynchronous Method Invocation
  8. How to use .NET to call methods in a non-blocking mode.

  9. Events Made Simple
  10. Events made simple

Wednesday, June 29, 2022

GOLD parser

GOLD parser

  1. Introduction to GOLD Parser
  2. This article introduces the GOLD Parser, a free, multi-programming language parser.

  3. Introduction to GoldParser
  4. In a previous article, I detailed my answer to a question from StackOverflow for which I wrote a Boolean expression parser. At the end of the article I indicated that it was better to generate the parsers with tools such as ANLR or GoldParser. In this post, we will see how to use it.

  5. GOLD Builder
  6. UPDATE! The GOLD Parser Builder is used to analyze a grammar and create the Compiled Grammar Table file used by the different implementations of the Engine. This application contains a large number of features designed to make the development of your language a breeze.

  7. GOLD parser
  8. GOLD parser

  9. Let Your Parser Go for the GOLD
  10. A Parser Generator that Speaks YOUR Language

  11. gold parser on google
  12. Tag Archives: Gold Parser
  13. Tag Archives: Gold Parser

  14. GOLD Parser Builder 4.1
  15. The GOLD Builder is used to analyze a grammar and create the Compiled Grammar Table file used by the different implementations of the Engine. This application contains a large number of features designed to make the development of your language a breeze.

  16. GOLD (parser)
  17. GOLD is a free parsing system that is designed to support multiple programming languages.

  18. Let Your Parser Go for the GOLD
  19. In a previous installment, you visited the inner workings of the Yet Another Compiler-Compiler (YACC) parsing system. This month, you go for the gold: the Grammar Oriented Language Developer (GOLD) Parser. Like most parsing systems, GOLD uses the LALR(1) state machine (algorithm) to analyze syntax and a Deterministic Finite Automaton (DFA) to identify different lexical units (tokenizer). Practically all common parser generators, such as YACC/Bison, use these algorithms. However, GOLD takes a different approach than common compiler-compilers. GOLD is freeware and uses the “zlib” style license so you can integrate it with your own apps without worry.

  20. Ancient Projects
  21. Ancient Projects

  22. Program Development
  23. Program Development

  24. LECTURE # 1 - INTRO TO GOLD PARSER BUILDER
  25. LECTURE # 1 - INTRO TO GOLD PARSER BUILDER

Tuesday, June 28, 2022

FileOpenDialog class

FileOpenDialog class

  1. CommonDialog.ShowDialog Method
  2. Runs a common dialog box.

  3. OpenFileDialog Class
  4. Displays a standard dialog box that prompts the user to open a file. This class cannot be inherited.

  5. FileDialog.Filter Property
  6. Gets or sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box. C#

  7. How do I only show CSV files when I open file dialog
  8. How do I only show CSV files when I open file dialog

  9. CommonDialog Class
  10. Specifies the base class used for displaying dialog boxes on the screen.

  11. Control.HelpRequested Event
  12. Occurs when the user requests help for a control.

desktop application deployment

desktop application deployment

  1. https://www.codeproject.com/Questions/5336026/How-can-I-make-the-desktop-application-runs-withou
  2. I have a C# Desktop Application. when i make release its generated with setup file. and i always need to setup the app first. and i don't need that step.any help ?

  3. .NET application publishing overview
  4. Applications you create with .NET can be published in two different modes, and the mode affects how a user runs your app.

    Publishing your app as self-contained produces an application that includes the .NET runtime and libraries, and your application and its dependencies. Users of the application can run it on a machine that doesn't have the .NET runtime installed.

  5. Tutorial: Containerize a .NET app
  6. In this tutorial, you'll learn how to containerize a .NET application with Docker. Containers have many features and benefits, such as being an immutable infrastructure, providing a portable architecture, and enabling scalability. The image can be used to create containers for your local development environment, private cloud, or public cloud.

  7. .NET Framework versions and dependencies
  8. Each version of .NET Framework contains the common language runtime (CLR), the base class libraries, and other managed libraries. This article describes the key features of .NET Framework by version, provides information about the underlying CLR versions and associated development environments, and identifies the versions that are installed by the Windows operating system (OS).

    Each new version of .NET Framework adds new features but retains features from previous versions.

  9. How to: Configure an App to Support .NET Framework 4 or later versions
  10. All apps that host the common language runtime (CLR) need to start, or activate, the CLR in order to run managed code. Typically, a .NET Framework app runs on the version of the CLR that it was built on, but you can change this behavior for desktop apps by using an application configuration file (sometimes referred to as an app.config file). However, you cannot change the default activation behavior for Windows Store apps or Windows Phone apps by using an application configuration file. This article explains how to enable your desktop app to run on another version of the .NET Framework and provides an example of how to target version 4 or later versions.

Monday, June 27, 2022

draw horizontal line

https://stackoverflow.com/questions/21990022/add-horizontal-line-to-chart-in-c-sharp

  1. Add horizontal line to chart in C#
  2. am using a System.Windows.Forms.DataVisualization.Chart to plot some x,y scatter data, like this:

Saturday, June 25, 2022

IEquatable interface

IEquatable interface

  1. implementing IEquatable and IComparable
  2. Recently, I created a ResearchItem class for my game, and I realized I wanted to sort them in a specific, non-alphabetical way. In the past when I wanted to control the sorting process I created an int SortOrder field. That I easily controlled how my items were sorted. There are several ways to accomplish this and I settled on implementing IEquatable <T > and IComparable <T >.

  3. IEquatable <T > Interface
  4. Defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.

  5. C# implement IEquatable
  6. Here is an example to implement IEquatable interface.

  7. Implementing IEquatable Properly
  8. Explains how to properly implement the IEquatable interface.

  9. Mystery of Equality in C#: IEquatable <T >, IEqualityComparer <T >, IComparable <T >, IComparer <T >
  10. What is the difference between these confusing words? They are very similar to each other. In this article, we will learn everything about them. But first, you need to learn two important prerequisites: Equals and GetHashCode. So our topics are:

  11. Using The IEquatable Interface In C#
  12. One of the most used functionalities in our C# classes is the ability to compare two instances of a class. This is done using the Equals keyword. This will compare to see if the reference to both the classes is the same. However, we might want to compare them and see if they are equal, based on some other field. Today, we will see how this is done in our C# classes.

  13. What's the difference between IEquatable and just overriding Object.Equals()?
  14. I want my Food class to be able to test whenever it is equal to another instance of Food. I will later use it against a List, and I want to use its List.Contains() method. Should I implement IEquatable < Food > or just override Object.Equals()? From MSDN:

  15. Optimizing C# Struct Equality with IEquatable and ValueTuples
  16. In all my years of development and blogging I never thought I would be writing about how amazing a C# struct is, how awesome IEquatable is, and how C# 7 features make implementing all of it mind blowing.

    In Xamarin.Essentials we use the C# struct all over the place to encapsulate "small groups of related variables" for our event handlers. They are groups of data that don't need to be created by the developers consuming the data and are only really used for reading the data.

  17. Always use IEquatable for Value Types
  18. You should always implement IEquatable <T > when checking for equality on value types. In this article I’ll go into a bit of depth on how Equals() behaves on System.Object and one of it’s derived class, System.ValueType.,

  19. Implementing the IEquatable of T interface for object equality with C# .NET
  20. In this short post we’ll see a way how to make two custom objects equatable using the generic IEquatable interface. Consider the following object:

  21. The Right Way to do Equality in C#
  22. One of the pitfalls of doing development in C#, Java, C++, or really any predominantly Object Oriented language (OOP) is how “equality” is defined.

    In C#, for instance, you have the following methods that are built into every object:

    1. object.Equals
    2. the == operator
    3. ReferenceEquals, for explicitly checking reference equality
    My personal opinion: in any managed language, checking for referential equality is a pretty bad default - and if you’re working with immutable objects then equality by reference doesn’t really work.

Friday, June 24, 2022

app.config reader

app.config reader

  1. App.Config Autoreader
  2. Automatic read and convert data of App.Config settings keys

  3. Cloning Objects in .NET Framework - Part I
  4. The importance of cloning objects in .NET Framework

  5. Cloning Objects in .NET Framework - Part II
  6. Continues with the cloning objects .NET Framework

  7. System.Diagnostics Useful Actions
  8. Useful Actions for debugger in System.Diagnostics

  9. Default(T)
  10. Use and examples for the keyword Default in generics

  11. Bend the .NET Object to your Will!
  12. Clone, serialize, and deep-compare any .NET object, regardless of type

  13. General Guidelines for C# Class Implementation
  14. Practical tips for making your classes good friends with .NET

this.components = new System.ComponentModel.Container();

this.components = new System.ComponentModel.Container();

    Problem

  1. Vertical Label Control in VB.NET
  2. This article describes how to create a custom vertical label user control in VB.NET.

  3. Why does the Visual Studio IDE sometimes initialize the "this.components object: and other times not?
  4. I've recently noticed some behaviour with the Visual Studio Designer (C#) that I don't understand and was wondering if someone could clarify...

    One some of my Windows Forms, the first line of the designer generated code reads;

    this.components = new System.ComponentModel.Container();
  5. system.componentmodel.container is missing how to add it?
  6. I have converted a VB.NET project in C# (win application), After conversion In Designer.cs under

  7. C# – Why does the Visual Studio IDE sometimes initialize the “this.components object: and other times not
  8. I've recently noticed some behaviour with the Visual Studio Designer (C#) that I don't understand and was wondering if someone could clarify…

    Must -Read on Component

  9. Containers, Sites, and Components
  10. Recall that a component derives from System.ComponentModel.Component, usually has no GUI interfaces , whereas a Control derives from System.Windows.Forms.Control and usually has GUI elements associated with it. Note the following basic points about component containers:

  11. Quick Review of Garbage Collection
  12. Quick Review of Garbage Collection

  13. Introduction to Components
  14. very good documents on Components

  15. Container Class
  16. Encapsulates zero or more components.

    C#
    public class Container : IDisposable, System.ComponentModel.IContainer
  17. Any idea why "this.components = new System.ComponentModel.Container();" gets duplicated in the designer?
  18. Any idea why "this.components = new System.ComponentModel.Container();" gets duplicated in the designer?

  19. System.ComponentModel Namespace
  20. Provides classes that are used to implement the run-time and design-time behavior of components and controls. This namespace includes the base classes and interfaces for implementing attributes and type converters, binding to data sources, and licensing components.

  21. Design-Time Integration
  22. With just a little effort, you can integrate nonvisual components and controls very tightly into the C# design-time environment, providing a rich development experience for the programmer who uses the custom components and controls that you build. Chris Sells shows you what's involved, in this sample chapter from Windows Forms Programming in C#.

  23. Understanding Visual Inheritance in .NET
  24. Inheritance is the single most important new object-oriented feature in Visual Studio.NET.

  25. winform,这句代码什么作用this.components = new System.ComponentModel.Container();
  26. 我默认创建一个winform窗体,都会带这句话. this.components = new System.ComponentModel.Container(); 但是,当我拖入一些控件的时候,再看代码,这句话,没了.

comboBox previous value / remove row in TableLayoutPanel

comboBox previous value

  1. Getting previous value of the ComboBox
  2. I want my application to grab the value of a ComboBox and then to set the one chosen by the user or to somehow get the previously selected value.

    The thing is that within my Form, there are four lists and a ComboBox (which contains all the values from the lists) and I want to repopulate the value of the ComboBox back to the list it was taken from and then remove the newly selected item from other/same list.

  3. How to retrieve value for previously selected item from the combobox
  4. Save value from the combobox for the index that will be changed.

  5. Remove Row inside TableLayoutPanel makes a layout problem
  6. I have a WinForms application that has a TableLayoutPanel; this is the definition code:

Thursday, June 23, 2022

gradient

gradient

  1. Gradient Enumerator
  2. The Gradient Enumerator is a simple utility to display resulting gradients from the combination of two colors.

  3. Simple Label Gradient
  4. Simple Label Gradient Control

Wednesday, June 22, 2022

VB.NET comparison

VB.NET

  1. Complete Comparison for VB.NET and C#
  2. This article explains about advantages, differences and new features of VB.NET and C#.

  3. Step by Step: Event handling in VB.NET
  4. Step by step guide to implement event handling in VB.NET.

  5. Cheat Sheet - Casting in VB.NET and C#
  6. Describes several casting and type related operations in VB.NET and C#.

  7. Secret Key Encryption Demo
  8. This application demonstrates how to perform secret encryption using VB.NET and the .NET Framework 3.0.

  9. Upgrading VB6 to VB.NET
  10. This article discusses various things to consider when upgrading a VB6 app to VB.NET.

  11. Encrypt/Decrypt Files in VB.NET (Using Rijndael)
  12. How to encrypt and decrypt files using Rijndael.

  13. gTrackBar - A Custom TrackBar UserControl (VB.NET)
  14. TrackBar with custom coloring, value display, label, and increment buttons.

  15. Adorners, Glyphs, Behavior, and ControlDesigner for WinForms Controls
  16. Interactive Design Time Control Overlays to make editing custom controls easier.

  17. Rich Design Time Editing with UITypeEditors (VB.NET)
  18. How to use UITypeEditors, Smart Tags, ControlDesigner Verbs, and Expandable Properties to make design-time editing easier.

  19. A Simple VB.NET Freehand Drawing method
  20. The code uses a System.Drawing.Drawing2D.GraphicsPath method to follow the users mouse movements. The path is then painted in the control.

  21. Add Custom Event to a Class in VB.NET
  22. Add Custom Event to a Class

  23. Eight Queens Problem using VB.NET
  24. Backtracking solution approach to solve the eight queens problems and get all unique solutions

  25. Using Structures in VB.NET
  26. Through this article, I wanted to introduce you to the structures in VB.NET. Also, I compared and contrasted Structures to Classes.

  27. VB.NET Knob Control
  28. A usable knob control.

  29. String Enumerations in VB.NET
  30. Fully compatible enumeration using strings in VB.NET.

  31. Basics of a Falling Blocks Game in VB.NET 2005
  32. A remake of the classic falling blocks game in a modern language

  33. Parsing Mathematical Expressions in VB.NET: Mission Possible
  34. This article introduces the implementation of an algorithm written in Visual Basic .NET that allows us to quickly and easily parse and evaluate the resulting value of various mathematical expressions

  35. Reading and Writing XML in C#/VB.Net
  36. Tips & Tricks on De/Serializing object graphs with XML

  37. VB.NET Knob Control using Windows Forms and GDI+
  38. User Drawn Control for .NET Winforms using GDI+

  39. GBVB - Converting VB.NET code to C#
  40. A tool and a method for VB.NET to C# source code conversion

  41. Drawing Round-Edged Rectangle Using VB.NET
  42. This code can be used to draw Round Edged Rectangles using VB.NET

  43. Drawing a Bar Chart
  44. This is an article about drawing a bar chart for a given set of values.

  45. Vertical Label Control in VB.NET
  46. Create a custom vertical label user control in VB.NET.

  47. Compile VB.NET code without Microsoft.VisualBasic.dll
  48. Compile VB.NET code without an implicit reference to Microsoft.VisualBasic.dll.

  49. Application settings in VB.NET 2.0 and Visual Studio 2005
  50. An article on using application settings in VB.NET 2.0 and Visual Studio 2005 to save the size and location of a form.

  51. Automate code-writing in VB.NET control's development
  52. Utility for automating code writing for VB.NET control's developers

  53. .Net Script Editor (C#,Vb.net Mini IDE)
  54. The source code / article published here is to provide features of MS Script control (Functions like AddObject) and some features of VSA/Visual Studio editor like intellisence, code completion etc

  55. VB.NET Calculating Linear Regression Slope and Intercept
  56. Mimic Excel Slope and Intercept functions for datasets

  57. A VB.NET Version of the Spider Solitaire Game
  58. In this article I will describe the approach I took in creating a VB.NET implementation of the Spider Solitaire Game.

  59. Windows Form Screenshot and Print Preview in VB.NET
  60. How to take a screenshot of a Windows form and then print it.

  61. Windows Form Screenshot and Print Preview in VB.NET
  62. How to take a screenshot of a Windows form and then print it.

  63. Console Line Editor in VB.NET 2.0
  64. Play with the new .NET 2.0's Console features, with this old time Line Editor.

  65. Line to Region
  66. This class gets an array of pointf() and returns the corresponding line region with custom width.

  67. Triangle List Generator for Sphere
  68. This article demonstrates a simple and fast method for generating a list of regular triangles that form a unit sphere surface

  69. Data Classification Using VB.NET and Genetic Algorithm
  70. A simple example of how to classify data using genetic algorithm and VB.Net

  71. Advantage of using Interface and Inheritance in VB.NET (OOP)
  72. This article will explain you tangible and functional example of using Interface with inheritance in VB.NET for Object Oriented Programming

  73. CSV to Excel XML Spreadsheet with VB.NET
  74. A simple program to create Excel XML spreadsheets from CSV files. Utility with source.

  75. Customisable WinForms Progressbar Control VB.NET
  76. A progress bar control you can customize

  77. Complete Sudoku Game for Windows using VB.NET 2013
  78. This article is a tutorial on how to code your own Sudoku game using VB.NET

  79. Using the VB.NET My Namespace in C# .NET 2.0
  80. In VB.NET 2.0, we have a new namespace, My, that exposes some nice classes. This article shows you how to access this namespace in C#

  81. Functions VS Subroutines and By Val Vs By Ref in VB.NET
  82. Functions VS Subroutines and By Val Vs by Ref in VB.NET

  83. DES and Triple DES Implementation in VB.NET
  84. A simple DES/Triple DES implementation in VB.NET that doesn't have instantiation overhead.

  85. A VB.NET class useful for color manipulation
  86. A VB.NET class for advanced colorimetric image processing and manipulation

  87. A VB.NET class useful for basic linear algebra
  88. Some vector and matrix manipulation routines.

  89. Windows Forms Controls: VB.NET Translucent Control using GDI+
  90. Build a standard Windows Forms translucent control using GDI+ & VB.NET

  91. A Polynomials Math Parser in VB.NET
  92. Polynomials Math Parser and Evaluator in VB.NET

  93. Complex Math Parser and Evaluator in VB.NET
  94. Reduces/evaluates a real/complex math expression

Sunday, June 19, 2022

VB projects - continued

VB converter

  1. Build My Own 3D Graphics Engine Step By Step
  2. How to build my own 3D graphics engine from ZERO step by step

  3. C# Equivalent of VB's IsNumeric()
  4. C# alternatives to VB's IsNumeric() function

  5. VB6 C# VB Code Converter
  6. Converting codes Focus on upgrading VB6 to VB.Net and converting C# VB.Net, and listing many other helpful converter including php, java & others.

  7. Mash Up: Code Converter
  8. This is a code converter that uses two different DLL files from around the .NET community. New Ver. 2013 is available for download.

  9. License Keys in VB.NET - Revisited
  10. License Key class to make generating and validating keys easy.

  11. Using VB to Create & Check License Keys
  12. Generate and check license keys embedding 16-bit configuration information

  13. NET Encryption Simplified
  14. A simple, string-oriented class for symmetric encryption, asymmetric encryption, and hashing.

  15. Recommended Reading for Developers
  16. This list was last updated in March 2015. Why are updates to my reading list so rare? Because computers change a lot in 10 years, but people don't.

  17. Space and Matrix Transformations - Building a 3D Engine
  18. This Article Describes How to Navigate 3D Space

  19. CurSur - 3D Curves and Surfaces in Geometric Design, in WebGL
  20. Three types of Curves and three types of Surfaces in Geometric Design - Cubic, Bezier and B-Spline, using Three.js Library

  21. A Calculation Engine for .NET
  22. A calculation engine that is small, fast, and extensible.

  23. About... The About Box
  24. A reusable About Box form for developers and users.

good C++ logic in collision detect and math library

    Developer ToolBox

  1. 3D Math Code
  2. It's just some base library for 3D-Math, but I think, it's not bad. Give it a try. It's not *fully* tested, because I hacked the last files together this morning... but I think, it's very easy to use.

  3. Math Library
  4. Here's my hat in the ring for math libraries. It's the math system for the engine I'm currently developing. I'm posting it in the hopes that someone else may find it usefull, but because I also want people to nitpick about it, any errors I may have missed, and ways to improve it. I am still working on the classes and adding to it, so any help is, of course, appreciated. The engine also works standalone, the project included compiles as a static library, which can easily be linked into a project. The include files are all linked through the GEKXMath.h file, so you only have to include it. The source is also commented (decently), compatible with (and a project file for) DoXygen source commentor. So far, it sports quite a few features:

    1. 2D/3D/4D vectors (seperate classes, I opted to seperate them instead of templating them so that I didn't have to specialize anything). I have overloaded basic operators for conveniance (like plus, minus, multiple, divide. I didn't want to overload actuall functions (like dot or cross product), because I felt it gets confusing to overload these, everyone has a different spin on what symbols to use.
    2. A quaternion class, with everything I've found that I've needed (so far at least).
    3. A 4x4 matrix class (and conversions between quaternions and matrices in the classes), with rotations, scaling, etc (everything a matrix should be able to do).
    4. A plane class, simple so far, I've just starting adding interesection between containment objects.
    5. A bounding sphere, and an axis aligned bounding box class, with intersections tests against themselves and each other.
    6. A 6 plane view frustum class, and a function to generate the planes from a projection matrix, and visibility checks against points, bounding spheres, and axis aligned bounding boxes.

    Featured Articles

  5. 3D Pong Collision & Response
  6. Here is an example / inspiration on how to handle a 3D pong / breakout game. It handles AABBox / Sphere collision tests, and perform some simple collision physics, based on an extended 'velocity reflection' model (does friction / restitution and handles difference in object mass). Thanks to the physics, Objects don't get squashed on walls, and react pretty well to multiple simultaneous collision. The code is unoptimised, but should be already quite fast already. SInce the collision detection routines work on overlaps, you have to be careful with the velocity of the objects, and their relative size (relative to their velocity). Swept tests would solve the problem of both accuracy and stability on thin&fast moving objects, but that's for another COTD.... Other goodies are,

  7. Source Documentation with Doxygen
  8. I used to maintain that good code is self-documenting. While I still believe that to a certain extent, such thinking makes a lot of assumptions about the person(s) who may be reading the code. As your project grows larger and additional programmers of varying skill levels (and areas of expertise) come on board, the need for good commenting and documentation becomes pretty clear.

  9. Plane Class
  10. This is a simple plane class that allows you to calculate the equation of a plane given three points, determine a points orientation to the plane and determine if a line from point1 to point2 intersects the plane

  11. A Small, Portable 3D Engine
  12. For the last few years at school, I�ve been using a TI-85 Graphing calculator. About a year and half ago, I tried to write a simple orthographic display, but it never got anywhere. Last month, I was extremely bored in math class, so I decided to see what I could program. I suddenly came up with a great idea for a perspective projection and implemented it. Various enhancements and optimizations have led to the 3D engine I use today. This article will describe the evolution of my engine from a sample program to a full library of portable software rendering functions, and document this library, called pGL (portable GL). The library interface is based on OpenGL (as much as a set of TI-85 programs can be based on C), because it is very simple and easy to use, and I also don�t need to replicate the long initialization and error-checking routines of DirectX.

  13. Basic Collision Detection
  14. I've seen a few tutorials on basic collision detection around the net, but most of them I've read are either pretty confusing or somewhat incomplete. I've attempted here to write a tutorial that anyone with a basic understanding of 3D concepts and linear algebra should be able to pick up on quickly. If you're already familiar with collision detection, there's no real reason to read further. I'm not presenting anything new here, just stating the basics and suggesting a few possibly "better" ways to do a step or two.

  15. 3D Geometry Primer: Chapter 1 by Bram de Greve
  16. Chapter 1 and chapter 2 are good.

Saturday, June 18, 2022

indexer

indexer

  1. nameof expression (C# reference)
  2. A nameof expression produces the name of a variable, type, or member as the string constant:

    Definition

  3. Indexers (C# Programming Guide)
  4. Indexers allow instances of a class or struct to be indexed just like arrays.

    The indexed value can be set or retrieved without explicitly specifying a type or instance member. Indexers resemble properties except that their accessors take parameters.

    The following example defines a generic class with simple get and set accessor methods to assign and retrieve values. The Program class creates an instance of this class for storing strings.

  5. Using indexers (C# Programming Guide)
  6. Indexers are a syntactic convenience that enable you to create a class, struct, or interface that client applications can access as an array.

    The compiler will generate an Item property (or an alternatively named property if IndexerNameAttribute is present), and the appropriate accessor methods.

    Indexers are most frequently implemented in types whose primary purpose is to encapsulate an internal collection or array.

    For example, suppose you have a class TempRecord that represents the temperature in Fahrenheit as recorded at 10 different times during a 24-hour period. The class contains a temps array of type float[] to store the temperature values. By implementing an indexer in this class, clients can access the temperatures in a TempRecord instance as float temp = tempRecord[4] instead of as float temp = tempRecord.temps[4].

    The indexer notation not only simplifies the syntax for client applications; it also makes the class, and its purpose more intuitive for other developers to understand.

    To declare an indexer on a class or struct, use the this keyword, as the following example shows:

    // Indexer declaration
    public int this[int index]
    { // get and set accessors }
  7. Indexers in C#
  8. In this article, I am going to discuss Indexers in C# with Examples. Please read our previous article where we discussed How to make Optional Parameters in C#. As part of this article, we will discuss what indexers are and how to create and use indexers in C#.

    Examples

  9. Learning C# (Day 8): Indexers in C# (A Practical Approach)
  10. OOP: Indexers in C# (A Practical Approach)

  11. Indexers
  12. Here we are going to introduce you to the concept of indexers in C#. Indexers can help simplify some programming aspects. Let us understand what these programming aspects are and then understand how indexers can help simplify them. To understand the programming aspects that indexers intend to simplify, we will go step by step with small programs.

  13. C# Indexer with Examples
  14. In c#, Indexer is a special type of property, and that allows instances of a class or structure to be indexed same like an array.

    If we define an indexer for a class, then that class will behave like a virtual array, and we can access that class instance values without specifying a type or instance member using an array access operator ([]).

    In c#, the indexer is same as the property, but the only difference is, the indexer will define this keyword along with the square bracket and parameters.

  15. Multiple Indexers In a Class Using Interface Indexers
  16. Using multiple indexers in a class using interface indexers.

Friday, June 17, 2022

user controls research

user control

may review it later with the same keyword to review.

  1. A Simple User Control
  2. A simple User Control for selecting a shape and entering dimensions.

  3. Anatomy of Hover-Click Controls
  4. This article presents a template for the implementation of user drawn Hover-Click controls.

  5. Targeting Design-Time Events of User Controls
  6. The article will go over various design-time features including smart tags, menu items, adornments.

  7. Construction and Design-Time Support of the RadioGroup User Control
  8. How to create a .NET user control combining several radio buttons with a border and a caption and provide it with handy support of Visual Studio at design time.

    Our experience of using of RadioGroup control demonstrated some problem: it was impossible to change forecolor of a control's caption. We fix this bug and supplemented the control with new properties and methods.

  9. Approaches for User Control Event Handling
  10. In this article, we will discuss the different ways of handling events in user controls.

  11. Dartboard User Control in C#
  12. Shows a dartboard on which you can click and which returns the score thrown

  13. Adding designable borders to user controls
  14. A tutorial on adding design-time enabled borders to user controls. Covers topics including atributes, interop, and custom overrides

  15. Ruler Control
  16. Ruler control in C#

  17. Calling parent form functions from a user control
  18. The Button inside the User Control raises the Button OnClick event on the form and typing inside the User Control TextBox replicates the text inside the Form’s TextBox.

  19. Fast Excel file reader with basic functionality
  20. A set of managed classes for native reading of data from MS Excel files

  21. TabStrip Control
  22. A flexible TabStrip control with basic design-time support.

  23. User control for selecting enum types.
  24. A user control to automatically display an enum, or bit-sets.

  25. Customizing User Controls with Smart Tag Feature
  26. This article explains how to add Smart Tag feature to a user control.

  27. How to Create an Event for a User Control
  28. Article on how to create a user defined event for a user control

  29. Extending user control and IDE/VS.NET Toolbox
  30. Extending user control and IDE Toolbox

  31. Magic TabControl - VS.NET Style
  32. An article on tab controls

  33. A Docking Control that can be Dragged and Resized by the User
  34. This control allows the user to resize and drag your docking control to different form edges.

  35. Magic Docking - VS.NET Style
  36. Docking Windows mimicking VS.NET feature

  37. A Docking Control that can be Dragged and Resized by the User
  38. This control allows the user to resize and drag your docking control to different form edges.

  39. Graph3D: A Windows.Forms Render Control in C#
  40. An easy to use 3D control which can be integrated into an application in a few minutes

  41. Creating Custom User Controls : Basic – II
  42. Creating Custom User Controls : Basic – II

  43. Creating Custom User Controls : Basic – I
  44. Creating Custom User Controls : Basic – I

  45. Creating Custom User Controls : Basic – III
  46. Creating Custom User Controls : Basic – III

  47. Write Your Own Bar Chart Winforms User Control
  48. An article on how to create a Bar Chart Winforms User control

  49. Detecting the IDE from a User Control
  50. This article describes a method to detect the IDE and/or the debugger in the code-behind of a User Control.

  51. Resolve DesignMode for a User Control
  52. The tip shows one way to resolve if a user control is in design mode.

  53. Advanced Shape Control
  54. Advanced Shape Control

  55. Extended .NET Controls
  56. A .NET library containing highly customizable controls.

  57. A 13x13 Grid Poker Hand Chart Windows Forms User Control
  58. A simple .NET control to display the 'standard' 13x13 grid for two card poker hands.

  59. FireFox-like Tab Control
  60. An article on Tab Control

  61. Free .NET Spreadsheet Control
  62. .NET Spreadsheet Control written in C#. Supports Cells Merge, Border Style, Pattern Background Color, Data Format, Freeze, Formula, Macro and Script execution.

  63. Resolve DesignMode for a User Control
  64. This is an alternative for "Resolve DesignMode for a user control"

VB projects

VB projects

  1. Basics of a Falling Blocks Game in VB.NET 2005
  2. A remake of the classic falling blocks game in a modern language

  3. Advanced Shape Control
  4. Advanced Shape Control

  5. How to read embedded resource text file
  6. How do I read an embedded resource (text file) using StreamReader and return it as a string? My current script uses a Windows form and textbox that allows the user to find and replace text in a text file that is not embedded.

    VB Type conversion

  7. Type Conversion Functions (Visual Basic)
  8. These functions are compiled inline, meaning the conversion code is part of the code that evaluates the expression. Sometimes there is no call to a procedure to accomplish the conversion, which improves performance. Each function coerces an expression to a specific data type.

  9. DirectCast Operator (Visual Basic)
  10. Introduces a type conversion operation based on inheritance or implementation.

  11. How to cast from Object to Integer in VB.NET?
  12. How should I cast from an Object to an Integer in VB.NET?

  13. Type Casting in Visual Basic .NET
  14. Visual Basic .NET provides two options for casting.
    1. CType: Casts or converts one type into another type. If the types do not match, coercion may be performed.
    2. DirectCast: Casts one type to another type with better performance than CType, but does not perform coercion if the types do not match.

    Note: CType includes all of the VB conversion functions. These are CBool, CByte, CChar, CDate, CDec, CDbl, CInt, CLng, CObj, CShort, CSng, and CStr.

    The main difference between the two is that DirectCast only works if the specified type and the run-time type of the expression are the same. This difference only appears when converting from an object type to a value type, or unboxing a value.

  15. DirectCast - VB.Net
  16. DirectCast - VB.Net

    If this conversion is not possible then an exception is thrown. This is another way to convert between different datatypes. The DirectCast works in a similar way to the CType operator but has a few imporatant differences:

    1. It only works with arguments that are reference type. If you pass a Value type then a compilation error will occur.
    2. It cannot perform widening conversions from Short to Integer.
    3. It cannot perform widening conversions from Single to Double.
    This method is slightly faster that CType so you should use CType when you need to cast rather than convert a value.
  17. CType - VB.Net
  18. If this conversion is not possible then an exception is thrown. When you use Option Strict On any datatype conversions must be explicit.

  19. Explicit Conversion
  20. There are three ways of performing an explicit conversion in C#
    1. Brackets - returns an instance of the type you are requesting or an exception. Also known as prefix casting or type cast operator.
    2. As - returns an instance of the type you are requesting or null.
    3. System.Convert - returns an instance of the type you are requesting or an exception.
    There are three ways of performing an explicit conversion in VB.NET 0) DirectCast 1) CType 2) TryCast - the equivalent of As
  21. Casting Reference Types in Visual Basic .NET
  22. Casting, or converting the value of a token from one type of data to another is common to most (if not all) programming languages. Visual Basic has long had a series of casting functions, such as CStr, CInt, Clong, etc. to allow conversion of one type of variable to another. While the idea of casting is simple and familiar when discussed in the context of a simple variable containing a value (.NET value types), the meaning and behavior of a cast is less clear when discussed in the context of objects.

  23. Converting Variable Types
  24. In many situations, you will need to convert variables from one type into another. Table 2.4 shows the methods of the Convert class that perform data-type conversions.

    In addition to the methods of the Convert class, you can still use the data-conversion functions of VB (CInt() to convert a numeric value to an Integer, CDbl() to convert a numeric value to a Double, CSng() to convert a numeric value to a Single, and so on), which you can look up in the documentation. If you’re writing new applications in VB 2008, use the new Convert class to convert between data types.

  25. DirectCast vs. CType
  26. Ok, I understand that in .NET I can use either the CType or DirectCast to convert variable datatypes, from object type to a specific datatype (like SelectedValue in the combo to integer or string even).

    What I want to know is the advantages and disadvantages between the two. Is one preferred over the other? What are most people using? Is there a performance gain of any kind for either one? Or a perfomance disadvantage?

  27. VB.NET and C# Comparison
  28. This is a quick reference guide to highlight some key syntactical differences between VB.NET and C#. Hope you find this useful! Thank you to Tom Shelton, Fergus Cooney, Steven Swafford, Gjuro Kladaric, and others for your contributions. Also see Java and C# Comparison.

  29. Casting and Data Type Conversions in VB.NET
  30. Casting is the process of converting one data type to another. For example, casting an Integer type to a String type. Some operations in VB.NET require specific data types to work. Casting creates the type you need. The first article in this two-part series, Casting and Data Type Conversions in VB.NET, introduces casting. This article describes the three operators you can use to cast in VB.NET - DirectCast, CType and TryCast - and compares their performance.

  31. Type Conversion Functions
  32. If you code "mixed mode" assignment statements (i.e., assign a string to an integer, assign a single to a string, etc.), VB.NET will perform the necessary conversions in such statements whenever it possibly can (provided that "Option Strict" is off). Such conversions are called implicit conversions.

    However, you can also use a set of functions that explicitly convert (or "cast") one type of data to another. The set of functions that enable you to do this all begin with the letter "C": CBool, CByte, CDate, CDbl, CDec, CInt, CLng, CSng, CStr, etc. Alternatively, you can use a corresponding method from the VB.NET Convert class to accomplish the same result.

    In addition, two older functions, Val and Str, enable you to convert from a string to a number and from a number to a string, respectively.

    The "Cxxx" functions and their equivalent Convert class methods are shown in the table below:

  33. Difference Between DirectCast and TryCast
  34. What is the difference between DirectCast and TryCast

  35. DirectCast vs. CType vs. TryCast
  36. DirectCast, CType, or TryCast ?

    I would like to see a discussion on the differences, advantages, and different situations in which each of these are best used within the context of .NET programming for Autocad.

  37. Cast Integer to Enum value : Enum « Data Type « VB.Net Tutorial
  38. Cast Integer to Enum value : Enum « Data Type « VB.Net Tutorial

  39. Speed Up Your VB.NET Code
  40. Optimization rules have changed under VB.NET-here are eight great new ways to build wicked-fast code.

    Best Comparison

  41. VB.NET and C# Equivalents
  42. Equivalents were produced with Instant C# and Instant VB.

  43. How to: Convert an Object to Another Type in Visual Basic
  44. You convert an Object variable to another data type by using a conversion keyword such as CType Function.

  45. Best practice for converting an object to string
  46. I've seen a number of ways of converting an Object to a String in .NET, typically for displaying the object's value to the user when the object type is not known.

  47. Convert String to DateTime
  48. In .Net, you can work with date and time easy with the DateTime class. You can use the methods like Convert.ToDateTime(String), DateTime.Parse() and DateTime.ParseExact() methods for converting a string-based date to a System.DateTime object.

    My Lesson in converting VB to VC project

  49. Advanced Shape Control
  50. Advanced Shape Control

    Convert two projects one by one into C#. then load control project and compile it. then load client project and compile it. We will run into all kinds of errors.

    Control project type conversion is easy, but there are some quirks...

    Client project somehow has not static main(). then I neeed to add Program.cs file and update project property and reset entry method. set startup object as Program.

  51. CSC : fatal error CS2017: Cannot specify /main if building a module or library
  52. I got the same error while upgrading from .Net Framework 4.0 to 4.51. Removing the StartupObject from the csproj file fixed the problem.

    solution: I also had this problem however the startUpObject was already showing (not set) in the properties page. To fix this I reselected the (not set) StartUpObject which then cleared this value from the project file. The element is then reset in the csproj file:

    < StartupObject > </StartupObject >

    If that doesn't work then I guess you might aswell just edit the csproj file directly to remove any erroneous text in this element

  53. Does not contain a static 'main' method suitable for an entry point
  54. Step 1: If you don't have a file named Program.cs, just add a new Class and name it Program.cs. Then paste this code:

    namespace Sales { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }

    Step 2: After placing the above code in Program.cs, follow below steps

    1. Right click on the project
    2. Select Properties
    3. Set Output Type to Windows Application
    4. Startup object : namepace.Program

  55. Compiler Error CS5001
  56. Program does not contain a static 'Main' method suitable for an entry point

    This error occurs when no static Main method with a correct signature is found in the code that produces an executable file. It also occurs if the entry point function, Main, is defined with the wrong case, such as lower-case main. For information about the rules that apply to the Main method, see Main() and Command-Line Arguments.

Thursday, June 16, 2022

coding style

coding style

  1. Code Style & Readability - Grouping Things Together
  2. How we group class members together makes a huge difference in the readability of our code.

    This is another article about code readability. This time focusing more on how we should group members together, and also showing some cases of just bad rules that some places and people seem to enforce for no actual benefit.

  3. Code Style & Readability
  4. Reasonings behind code-styles and why we shouldn't be using "auto-formatters" all of the time

    Lately, I see an excessive use of code-formatting tools. The basic argument is that if the code follows a strict standard, it is easier to read. Yet, what is easier to read for a computer is not necessarily easier to read for humans, and this article will present situations where understanding the code style is more important than just following a "simple recipe" that can make things really weird.

Monday, June 13, 2022

Web request time out topics

Web request time out topics

  1. Web request timeout in .NET
  2. I am trying to make a web service request call to a third part web site who's server is a little unreliable. Is there a way I can set a timeout on a request to this site? Something like this pseudo code:

  3. WebRequest.Timeout Property
  4. Gets or sets the length of time, in milliseconds, before the request times out.

  5. WebExceptionStatus Enum
  6. Defines status codes for the WebException class. This API supports the product infrastructure and is not intended to be used directly from your code.

Sunday, June 12, 2022

Git Version control

Git Version control

  1. Version Control
  2. Version control, also known as revision control or source control, is the management of changes to documents, computer programs, large websites, and other collections of information. Each revision is associated with a timestamp and the person making the change. Revisions can be compared, restored, and with some types of files, merged.[1]

  3. Version Control Systems
  4. Version control systems are a category of software tools that helps in recording changes made to files by keeping a track of modifications done in the code.

Saturday, June 11, 2022

file watcher

file watcher

  1. A Robust Solution for FileSystemWatcher Firing Events Multiple Times
  2. This is a robust solution for FileSystemWatcher firing events multiple times

  3. Refreshing the .NET Application to Read Modified Configuration Files Values
  4. In .NET applications, we encounter two types of configuration files. One is "Web.config" which is used for configuring the settings for a Web application and the other is "App.config" used for Windows application settings.

  5. Reading file content changes in .NET
  6. In Linux, a lot of IPC is done by appending to a file in 1 process and reading the new content from another process.

    I want to do the above in Windows/.NET (Too messy to use normal IPC such as pipes). I'm appending to a file from a Python process, and I want to read the changes and ONLY the changes each time FileSystemWatcher reports an event. I do not want to read the entire file content into memory each time I'm looking for changes (the file will be huge)

  7. FileSystemWatcher Class
  8. Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.

  9. How to refresh text from a text file [duplicate]
  10. I am trying to make a chat program which reads text from a text file on a shared folder. The problem I am having is when you type stuff it doesn't refresh meaning if someone else adds anything else to the text file you wont see it does anyone have an idea of how to fix this.

debug vs release build

debug vs release build

    Must Read

  1. An expression evaluator written in VB.NET
  2. An expression evaluator written in VB.NET.

  3. Building an embedded database engine in C#
  4. DbfDotNet is a very fast and compact fully managed standalone database/entity framework, for the .Net Framework.

  5. Embedded Firebird: Full-Featured Embedded Database with 2 MB Runtime
  6. An example that shows how Firebird database excels in embedding.

  7. What features to implement in a version control system? [closed]
  8. I will be implementing a version control system in C++ for my final year project. I would like to know: What are the features a version control system should must support. What features do you consider are missing in existing implementations (so that my version control system does more than just reinventing the wheel) References (if any) to start with.

    Release Build

  9. C# Debug vs. Release Builds and Debugging in Visual Studio – from Novice to Expert in One Blog Article
  10. Most articles and documentation about the 'out of the box' C# Debug and Release build configurations were written prior to Roslyn. I take a fresh look at what you now get under the covers in 2018.

  11. A Treatise on Using Debug and Trace classes, including Exception Handling
  12. C#'s built in Debug and Trace classes can be confusing and inappropriately used. This article looks at one success story using debug traces and assertions, and presents an improved debug class.

  13. Considerations for implementing trace facilities in release builds of .NET applications
  14. What is the best technique to produce trace output in release build of .NET application, i.e. when application is shipped to a customer or runs in a production environment? The article discusses pros and cons of standard .NET trace facilities, and presents some alternatives.

  15. Writing custom .NET trace listeners
  16. Presentation of various ways to customize built-in .NET trace facilities

  17. From Mocks to Isolation
  18. The article discusses how to isolate the code under test from behavior of referenced classes by using mocking frameworks.

  19. How To Speed Up Your Company’s Next Release
  20. In this article we look at how systematically generating test cases through Broadcom’s Continuous Testing suite can significantly speed up your team’s development process.

  21. Implementing the .NET IComparer interface to get a more natural sort order
  22. The IComparer available in .NET lets you sort numbers or strings. This little class available in both C# and VB shows how to implement an IComparer which will work with mixed characters and numbers.

StatusStrip label not visible when text too long

toolstripstatuslabel text did not show up

  1. StatusStrip label not visible when text too long
  2. I have a StatusStrip docked to the bottom of a C# Form, it contains a label, the text in it displays fine, except when there is longer length of text then it does not display at all, and I have to widen the form and then all of a sudden it appears. Is it possible to show it in the form below:

  3. ToolStrip Control Architecture
  4. The ToolStrip and ToolStripItem classes provide a flexible, extensible system for displaying toolbar, status, and menu items. These classes are all contained in the System.Windows.Forms namespace and they are all typically named with the "ToolStrip" prefix (such as ToolStripOverflow) or with the "Strip" suffix (such as MenuStrip).

  5. StatusStrip In C#
  6. A typical status bar control, placed on the bottom of a Form is used to display some text that represents a status of the application and user actions. In the previous versions of the Windows Forms, the StatusBar control is used to provide the status bar functionality. In Windows Forms 4.0 that is a part of Visual Studio 2010, the StatusStrip control replaces the StatusBar control. The StatusStrip control not only provides status bar functionality but also provides features to add rich user interfaces to a status bar such as a ProgressBar, DropDownButton and SplitButton controls.

  7. C# StatusStrip Example: Windows Forms
  8. StatusStrip. A StatusStrip displays window status. It is usually at the bottom of a window. We use a ToolStripStatusLabel hyperlink in the C# Windows Forms status bar.

  9. ToolStripStatusLabel.BorderStyle Property
  10. Gets or sets the border style of the ToolStripStatusLabel.

    String Format

  11. How to do Alignment within string.Format in C#?
  12. Console.WriteLine(String.Format("{0,-10} | {1,5}", "Bill", 51));

  13. Aligning strings within string.Format and interpolated strings
  14. I was browsing through the MSDN docs the other day, trying to remind myself of the various standard ToString() format strings, when I spotted something I have somehow missed in all my years of .NET - alignment components.

    This post is for those of you who have also managed to miss this feature, looking at how you can use alignment components both with string.Format and when you are using string interpolation.

  15. Format strings to Right-Justify when an application calls printing
  16. This article introduces how to format strings to Right-Justify when an application calls printing.

  17. C# string format
  18. The C# string format is used to modify a string. It does so by inserting objects and variables at desired positions.

Thursday, June 9, 2022

Polymorphism

C# polymorphism microsoft

    Must Watch

  1. Understanding C# Interfaces and Polymorphic Behavior by Dan Wahlin
  2. In a previous session Getting Started with C# Interfaces, I talked about how you can use C# Interfaces to drive consistency across different C# Classes. In this session, I’m going to walk through one of the cool features of Interfaces, which is Polymorphic Behavior.

  3. Getting Started with C# Interfaces by Dan Wahlin
  4. One of the topics that I get the most feedback or comments or questions about is C# Interfaces. What are they? Why would I use them? Why are they important in our applications? What I’m going to do is try to break down C# Interfaces in just a real short little segment here and make some sense of why you might use those in your applications. The short answer is we’re going to use C# Interfaces to drive consistency.

    Good Posts

  5. Compile-Time Polymorphism in C#
  6. Object oriented programming is a rabbit hole where polymorphism is just another thread in the hole, let’s see how deep can it go.

  7. Understanding Polymorphism using Abstract Classes in C#
  8. Polymorphism is a very helpful concept when it comes to a single abstract idea used in different ways and shapes. With polymorphism, you can define a single abstract class and reshape it in different ways to suit your methods & ideas.

  9. Getting Started with Inheritance using C#
  10. Inheritance allows us to maintain, modify, and further improve our code. It provides us the ability to reuse code functionality. Without inheritance, our code will be unstructured, difficult to read, and complex.

  11. Polymorphism in C#
  12. The name polymorphism implies one word having many forms. In programming, this means that an object can have multiple functionalities. Polymorphism is one of the fundamental concepts in object-oriented programming.

    There are mainly two types of polymorphism i.e static polymorphism and dynamic polymorphism. Details about these are given as follows:

  13. Polymorphism
  14. Polymorphism is the next fundamental principle of Object-Oriented Programming (OOP). Polymorphism is a Greek word that means many-shaped i.e. one object has many forms or has one name with multiple functionalities.

  15. Understanding virtual, override and new keyword in C#
  16. Polymorphism is one one of the main aspect of OOPS Principles which include method overriding and method overloading. Virtual and Override keyword are used for method overriding and new keyword is used for method hiding. In this article, In this article, I am going to explain each keyword in details with the help of C# code.

  17. C# Polymorphism - c# - c# tutorial - c# net
  18. The term "Polymorphism" is the combination of "poly" + "morphs" which means many forms.

  19. Polymorphism - Method Overloading and Method Overriding in C#
  20. Polymorphism means “Many Forms”. In Polymorphism, poly means “Many” and morph means “Forms” Polymorphism is one of main pillar in Object Oriented Programming. You can create multiple methods with same name but different signature in same class or derived class for modifying the functionality of base class. It provides different implementation of method that is implemented with same name.