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.
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.
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.
There are no special problems with passing parameters to an application at startup in C#, it's done quite simply like this: static void Main(string[] args) { if (args.Length == 0) { MessageBox.Show("No parameters"); } else { MessageBox.Show("1");…
In this post, I will provide an example of how to get battery charge information on a Windows Mobile device. The code was written a long time ago. Recently, I needed it again. To get the battery charge, we use c...
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
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.
Not long ago, I started developing an application on C# based on PostgreSQL, and I'd like to share the information I've found. In this article, I'll describe what you need to connect to PostgreSQL from an application written in C#, and how to work with it using examples. ...
I hope this publication will not give readers the opportunity to repeat my mistakes and help make the initial correct choice. First, I would like to start with a strong recommendation: "When programming under .NET, always use MySQL .NET Connector!". Of course, you can connect to the database using ADO, but this is fraught with the fact that you will simply need to make changes when switching to Windows Vista and above.
Recently, I had to sort lists, and surprisingly, it turned out to be simple. Let's say we have a class: Creating a list: Now, to sort it by the ID field, we need to do just this: As you can see from the picture, I became curious about how quickly this all works.