.Net & C#

How easily write the text of connection string

Create empty file and call it “test.udl”. In Windows it be with the icon like in Figure 1. UDL means “Universal data link”  and open this file. This post is for registered users only.  Read more»

.Net & C#

C#. How to join in string array of int

We have array of int and want to write it to a variable or to show on display. It’s not so easy to do in one string as you can think at first. Below I wrote one of  ways to do it. Read more»

.Net & C#

Regular Expressions in C#. Get text before specified character

Regular expressions is one of the best ways to work with text. One popular task for Regexp is to get a part of word or expression.Let’s try to get first part from word “Heli-copter”, the part that before character “-“.  Read more»

.Net & C#

Get all IP addresses from text C#

Using “System.Text.RegularExpressions” in C# you have a lot of abilities to work with text. One of practice of using System.Text.RegularExpressions is working with IP addresses. Read more»

.Net & C#

Associative arrays in C# via IDictionary

There’re no associative arrays (hash) in common sense. There are Dictionaries for this. It’s a very good tool if you want to use link “key-value”. Using Dictionaries, keys and values can be different types. Read more»

.Net & C#

C#. Add new line symbol to string

Each time I forget how to add new line symbol to string. I decided to add to memories. Below how to add new line symbol to string in C#. string message = Label1.Text; message = message.Replace("<br />", System.Environment.NewLine);     Read more»

.Net & C#

Fixing C# and GridView error – String or binary data would be truncated. The statement has been terminated

I was creating a simple tool to work with database table. When I coded a part of updating table records I got some errors. One of them was: Fixing C# and GridView error – String or binary data would be truncated. The statement has been terminated Read more»

.Net & C#

C#. Add html tags and formatting in Gridview cell

When I tried to add html to data for my GridView control, I could only see html code. I could see “<span class=”myhtmlclass”>my text</span> from SQL request</span>. But I wanted to wrap my content with <span> tags. Read more»

.Net & C#

Fixing error “‘Namespace.className.source’ is inaccessible due to its protection level” in C#

The reason of error  “‘Namespace.className.source’ is inaccessible due to its protection level” is that by default class variables “source” and “substitute” are protected and you don’t have access to them anywhere out of the class. Read more»

.Net & C#

Add hyperlink to GridView programmatically

GridView is a powerful and easy in use tool in Asp.net, especially if you know how to use it. There are a lot of tutorials how to add dynamic hyperlink column to GridView not programmatically, but this tutorial is about how to add hyperlink to GridView programmatically (in code-behind). Read more»

.Net & C#

Popular Posts