⌘BABAKOV.NET Let's code!
100% [light] [ru]
~/programming $

Development

102 total · page 8 / 11
Subsections

Creating Programmatically DataGridViewComboBoxCell in C#

In this post, I will provide an example of how to programmatically add DataGridViewComboBoxCell. How to programmatically fill DataGridView was considered here. The operation of converting the selected DataGridView cell is performed with an existing cell, so we need to create this cell using the previous article, in our case, we will change cells in column 1 and row 1.<br><br>This method works 100% with text fields. You can also not convert and set it immediately. But in this case, I am assuming that not all cells need to be ComboBoxes and therefore such a need may arise.<br><br></p> [[B0]] <p><br><br>We have selected a cell from our datagrid and made it a ComboBox.<br>Now we are filling… <br><br></p> [[B1]] <p><br><br>That's it.</p>

31 views 0 comments 0 likes ./Read →

Hello World - First Mobile Application on C# .NET CF.

Here I will provide an example of creating the simplest application for a PDA on the .net cf platform. I would like to note one point, that in your development you can certainly use emulators, but I do not recommend it. Many tasks that need to be solved are impossible to solve using emulators, so if you want to develop something more or less serious, it is worth acquiring a mobile device. Fortunately, the cheapest can be bought almost for pennies. There is no need to buy a new, modern, and over-featured device, an old, worn-out device bought from hand for pennies will be enough.<br><br>So, let's get started.<br>For developing applications, we will use Visual Studio - you can choose from 2003 to the latest, it's better to choose the newer one, the differences between versions are not significant (at least in the case of the example being considered). <br>There is another point. In 2005 and later versions of Visual Studio, .NET CF is used - at least version 2. From which it follows that your applications will not work on all that does not support at least the second framework. Such devices are extremely rare (personally, I only met industrial terminals on Windows CE 4.2) - but if this is your case, then here there is no choice but Visual Studio 2003, although it is better to update the equipment, in my opinion.<br><br>So - we start Visual Studio and create a new project. We will develop the application in C#. To create a new application, we choose the Smart Device tab, specify the project name and framework version. In the latest version, 2008 Visual Studio, you can choose 2, 3, and 3.5 frameworks.<br><a href="[[B1]]" class="highslide"><img src="[[B2]]" alt=""></a> <br>Next, we choose the device type. In our case, it's not very important - we'll choose PocketPC 2003<br><a href="[[B3]]" class="highslide"><img src="[[B4]]" alt=""></a> <br>A window will appear with a form to which we add a Button (Button1) and a Label - text (Label1) we get this:<br><a href="[[B5]]" class="highslide"><img src="[[B6]]" alt=""></a> <br>Now, we create an event handler for the button's OnClick event. When the button is clicked, we will change the text in Label1 to Hello World!.<br><br>That's it - we run our project in the emulator.<br>We click the button and admire the result.<br>If you have a device for experiments, you need to install .NET CF 3.5 on the device in advance - only then copy the files from the Debug project folder and run them.

21 views 0 comments 0 likes ./Read →

DataGridView Example of Programmatic Adding Cells C#.

Here I will provide an example of programmatic adding cells, and accordingly columns and rows. This may be necessary when you very much need to fill DataGridView and at the same time do not need a DataSet. In my case, this is required most often when it is necessary to fill some parameters that may differ for the same object, for example, there may be a different number, in addition, they may be of different type, etc.<br><br>So, example:

60 views 0 comments 0 likes ./Read →

Using Crystal Report in C#

In this article, I will provide an example of creating and using a Crystal Report in Visual Studio. The provided example is a real working project for preparing tickets for printing on a standard laser printer. Let's start with what we need, which is a data source, so first create a project where we will use our report and create a data source that we will export to an XML file, for a more simple and intuitive creation of a new report and its settings.

352 views 0 comments 0 likes ./Read →

Programmatic Adding Events to Controls in C#

There are often cases when creating an event for controls programmatically is necessary, for example, when we need to perform certain manipulations with elements and data they contain before events are processed. This can be on change of selected value, mouse click, change of content, and many other events. It is advisable to create events programmatically rather than in the designer. I will show how to do this in an example.

106 views 0 comments 0 likes ./Read →

Working with Strings in C#

The String class includes a number of methods for comparing, searching, and modifying string values. Here I will list the most frequently used (by me) capabilities of this class: Empty — a property that determines whether a string is empty; Compare() — compares two strings; CompareOrdinal() — allows comparing strings regardless of regional settings; Concat() — combines two or more strings into a new string; Copy() — copies the original string; Equals() — checks whether two strings have the same values; Format() — formats a string using a strictly defined format; Intern() — returns a reference to an existing string instance; Join() — adds a new string to a specified location in an existing string; Chars — a character index of the string; Length — the number of characters in the string; Clone() — returns a reference to an existing string; CompareTo() — compares one string with another; CopyTo() — copies a specified number of characters from the string to a Unicode character array; EndsWith() — checks whether a string ends with a specified sequence of characters; Equals() — determines whether two strings have the same values; Insert() — inserts a new string into an existing one; LastIndexOf() — returns the index of the last occurrence of an element in the string; PadLeft() — aligns a string to the right, skipping all spaces or other specially defined characters; PadRight() — aligns a string to the left, skipping all spaces or other specially defined characters; Remove() — removes a specified number of characters from the string; Split() — returns a substring separated from the main array by a specified character; StartsWith() — determines whether a string starts with a specified sequence of characters; Substring() — returns a substring from the main character array; ToCharArray() — copies characters from the string to a character array; ToLower() — converts characters in the string to lowercase; ToUpper() — converts characters in the string to uppercase; Trim() — removes all occurrences of specified characters from the beginning and end of the string; TrimEnd() — removes all occurrences of specified characters from the end of the string; TrimStart() — removes all occurrences of specified characters from the beginning of the string.<br><br>That's all the main stuff.

29 views 0 comments 0 likes ./Read →

How to Teach a PDA to Play WAV Files in .NET CF

A mobile device with .NET CF version 3.5 (and hopefully higher) support can be easily taught to play media files in the .WAV format. From this version, .NET CF has the necessary set of functions for playing sound files. Without further ado, I will provide simple examples.<br><br>Two examples of playing a sound file:<br><br>Example #1

17 views 0 comments 0 likes ./Read →

Errors in Compiling Smart Device Setup Project and Their Treatment.

So — when creating the .cab file for the first time, there may be an error when installing on a device, and it is likely to occur: The Windows CE CAB Wizard encountered an error. See the output window for more information. To understand what's going on, we look at what's really complaining about. We open: View->Output. There, we see this: Error: The INF file contains Unicode characters that could not be converted correctly to ANSI. The problem (in my case) was that in the project properties, Manufacturer was written in Russian. I changed it to English and everything started working fine.

22 views 0 comments 0 likes ./Read →