Tumgik
Text
List all SQL Instances on a local machine in C#
List all SQL Instances on a local machine in C#
This is just another SQL C# articles which let you learn how to make a list of names of SQL instance available on your Microsoft SQL Server using C# code.
This is made possible using Registry entries.
private IEnumerable ListLocalSqlInstances(RegistryKey hive) { const string keyName = @"Software\Microsoft\Microsoft SQL Server"; const string valueName = "InstalledInstances"; const string…
View On WordPress
0 notes
Text
How to Check for a database on SQL Server using C#
How to Check for a database on SQL Server using C#
This is just another SQL C# articles which let you learn how to check for a database existence on SQL Server.
All you have to do query names in sys.databases table and make sure it is available to use. You can create a function for the purpose.
public static bool IsDBExist(string server, string db) { List list = new List(); // Open connection to the database string conString = null;…
View On WordPress
0 notes
Text
C# Tips: Create Directory if not exist
C# Tips: Create Directory if not exist
Do you know that , In C#.Net it is possible to check directory is exist on a particular path on a system using System.IO library.
This will be great help when we want to implement the software on a system, with folder structure we are using to store out put or backup folder structure. The following simple function may help you
View On WordPress
0 notes
Text
How to set background image using ImageBrush in C# WPF
How to set background image using ImageBrush in C# WPF
Back ground in WPF application can be set using XAML at design time or at run time. Using XAML we do it as follows
<Window.Background> <ImageBrush ImageSource="images\abstract-art-artistic-background-1103970 (1).jpg"/> </Window.Background>
At Runtime
Using some code you can change back ground of WPF /C# application using ImageBrush and BitmapImage object as follows
Create
View On WordPress
0 notes
Text
Serialize Helper class for encrypt and serialize any C# object
Serialize Helper class for encrypt and serialize any C# object
Serialization is the process of storing objects / user defines classes into a disc files. It stores state of the object i.e. member variable values to disk. Deserialization is reverse of serialization i.e. it’s a process of reading objects from a file where they have been stored.
As you know encryption is to hide information from others .Encryption and decryption operations require a special 
View On WordPress
0 notes
Text
Convert Doc file to PDF,XPS,SVG,XML,HTML using Spire in C#
Convert Doc file to PDF,XPS,SVG,XML,HTML using Spire in C#
There are many useful libraries around Nuget which can be made your application more productive. We already learned how to create PDF files from a Word Document using Interop and Docx.
Free Spire.Doc offer high performance operation on word documents. You can check the project on Codeplex Achive
Spire offer following feature
*Convert Word to PDF
*Convert Word to HTML
*Convert Word to…
View On WordPress
0 notes
Text
Create Word Document programatically with Docx in C#
Create Word Document programatically with Docx in C#
Docx is an opensource library which provide creattion and manipulation of Microsoft Word Document. It is one of of the easiest way to create documents in your C# application. Above all no need to install Office word on your system and it is fast.
The developer mad a good and fruitfull effort to deliver such a fast library, thanks lot
First you need to add the library to your project and…
View On WordPress
0 notes
Text
How to convert a WordDocument to PDF in C#.Net
How to convert a WordDocument to PDF in C#.Net
Word Document is an essential part of any application, it may help users to prepare reports etc. You can easily create Documents programamatically using Microsoft.Office.Interop.Word Library in C#.Net.
This Library also provide capability of converting document to two another monstly used file format, PDF and XPS. Let’s beggin
First up all add refrence to Microsoft.Office.Interop.Word and…
View On WordPress
0 notes
Text
C# WPF Tips : How to bind array/list elements
C# WPF Tips : How to bind array/list elements
Binding is an ideal technique for displaying dybanic content in to application in WPF. Todays tips is about how to bind list/array elements in a C# WPF app.
In my C# code I have specified the binding as follows.
List<string> myvalues = new List<string>() { "May 2020", "May", "Monday", "25/May/2020" }; txt_month.DataContext=myvalues;
I wan t to bind the second element, that means second…
View On WordPress
0 notes
Text
Sorting CollectionView using Orderby in C#
Sorting CollectionView using Orderby in C#
We already learned Filtering, lambad experssion on collection view, and the last one you may want to know how to get a sorted list from a collection view.
AsEnumerable () function makes it easier to sort collection view. In our example we had a StockView class which hold information for Stock of an inventory.
StockView
class StockView{ public string Batch{ get; set; } public int Qty{…
View On WordPress
0 notes
Text
Create aggregate function using lambda expressions on collectionView in C#
Create aggregate function using lambda expressions on collectionView in C#
Hope you need this article for updating your skills. As we seen in the last article, we learned about collection view and how to create filters using them. If you miss just take a look at it. To I will help you learn som lambda expression
Lambda experession ?
Lambda expressions permit the creation of anonymous functions with a very concise syntax. I don’t want explain what lambda…
View On WordPress
0 notes
Text
ListCollectionView for sorting,filtering data collection
ListCollectionView for sorting,filtering data collection
When we wanted to perform filtering, sorting of data over a binded data collection, collection view might be helpful. If the source collection implements INotifyCollectionChanged interface, the changes raised by the CollectionChanged event are reflected to the views.
ListcollectionView Represents the collection view for collections that implement IList as Mictosoft Doc says.
Create a…
View On WordPress
0 notes
Photo
Tumblr media
C#Tips/Tricks – XAML Formating Do you know , within XAML element of you C# WPF application , the binded data can be formated using string format. For a date field you can use the following style <TextBlock x:Name="tbl_fy" Text="{Binding [0].f_date1, StringFormat={}{0:MMM/dd/yyyy}}" Foreground="Beige" FontSize="14" Width="119"/>
0 notes
Text
WPF: Observable collections for dynamic itemsource
WPF: Observable collections for dynamic itemsource
ObservableColeection is ObjectModel collection which can be used to store and l list of objects in .Net. One of the notable feature of this collection is that unlike other collection it can be automatically update itemsources.
Observablecollection implements IObservable Interface
C# ObjectModel collection
Where to use Observable
Observable can be best fit where keep need to observe…
View On WordPress
0 notes
Text
C#Tips/Tricks - Linq and Functions
C#Tips/Tricks – Linq and Functions
Do you know Linq in c# has special capabilities to handle data smoothly. As we learned you can operate on user defined types and list using Linq.
Even you can use your own functions from within the Linq
C# Linq
The following example illustrate how to use functions within Linq
var salesSummary = (from s in salesTable.AsEnumerable() join c in Customer.AsEnumerable() on…
View On WordPress
0 notes
Text
Useful Visual studio Shortcts
Useful Visual studio Shortcts
Alt+A for add an items from unimported name sapce
Ctrl + K+S sunrround with
Double Tab after try for aout completion
View On WordPress
0 notes
Text
WPF: DataTemplate for handling multiple set data
WPF: DataTemplate for handling multiple set data
With the help of XAML you can almost change each and every element in your WPF Window UI. Using the templating system you can overload the existing behaviour of control and can apply to other control you were adding . So do onece and reuse later that’s what template and style says.
As name indicate DataTemplate in WPF handles data set. Lets come to our example , I have two type of datas which…
View On WordPress
0 notes