How to run a task asynchronously using Windows Service C# If you need to run something, let’s say every 10 minutes or hours we can use C# to develop a Windows Service in Visual Studio and that will do the … Read More
Author Archives: Abbas Khan
Windows Service: Command Text property has not been initialized
Windows Service: Command Text property has not been initialized When calling a SQL query in Windows service might throw an error Command Text property has not been initialized Usually this error is that Windows Service can’t find SQL query code. … Read More
How to install a Window Service on server without visual studio tools
If need to install a window service on a server where Visual Studio is not installed or you don’t have Visual Studio tools then follow the steps below 1) You can find InstallUtil.exe at following directoryC:\Windows\Microsoft.NET\Framework64\v4.0.30319 (depending on system it could … Read More
Simple tutorial to create Xaml Workflow in Visual studio 2013
Create a simple Workflow console application using Xaml Workflow Go to new project in Visual Studio 2013 and select Installed>Templates>Visual C#>Workflow>Workflow Console Application Give it a name “WindowsWorkflow.ConsoleApp” Delete Workflow1.xaml file as we will be adding a new file Right … Read More
How to Add a Datagrid in WPF
–Datagrid in WPF 1) Create a Datagrid <DataGrid x:Name=”uxHistory” AutoGenerateColumns=”False” IsReadOnly=”True” Margin=”0,5,0,0″> </DataGrid> 2) then define datagrid column <DataGrid.Columns></DataGrid.Columns> 3) Now add DataGridTemplateColumn field to actually specify data related to each column <DataGridTemplateColumn Header=”{DynamicResource ResourceKey=RegistrationSearchControl.ApplicationNumber.TextBlock.Text}” Width=”Auto”></DataGridTemplateColumn> 4)<DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn.CellTemplate> 5) <DataTemplate></DataTemplate> 6) … Read More
WPF: How to get a selected row value from Datagrid on double click
A very simple of getting a selected row value from Datagrid on double click… 1) Create a double click event on WPF form/window private void uxABC_MouseDoubleClick(object sender, MouseButtonEventArgs e){ myData decData = uxABC.SelectedItem as MyData; Guid myId = decData.MyId; } … Read More
How to display a new window by double clicking a row in datagrid in WPF
An easy way of displaying a new window in WPF by double clicking a selected row in Data Grid Add a new second window to project Once added, add any datagrid, rows, columns you need to, example Then go FirstWindow.xaml … Read More
WPF call main parent control in child control with event handler
Below is a simple example of a WPF solutio and explains how to call a parent control’s method in child control click event. In this case we will be using 1) Main window 2) Parent user control 3) Child user … Read More
Sending data in utf-8 format in REST service
I had a requirement from a client where data we were trying to send had some non-english characters i.e. Turkish characters.Usually sending data by converting into bytes and send a stream works but client was unable to read. Below are … Read More
Why not to use try exception in C# service
I was working on a REST service for a client and then that service was being used by a third party to throw huge data in it. Couple of methods we being called and everything seemed to work fine however … Read More