Posts

Donate

The type of one of the expression in the join clause is incorrect.Type inference failed in the call to GroupJoin In C#

Hi, I just tested on grouping two collections using GroupJoin approach in LINQ to XML. In the example, the two collections are Customers and Companies. In which, companies served as grouping for the customers. In simple terms, identify a customer of which company he or she belongs. The code below produced an error The type of one of the expression in the join clause is incorrect.Type inference failed in the call to GroupJoin. XElement companiesAndCustomers = new XElement( "CompaniesAndCustomers" , from company in companies join customer in customers on company equals customer.CompanyName into groupCompany select new XElement( "Company" , new XAttribute( "CompanyName" , company.CompanyName), new XAttribute( "Country" , company.Country), from subCustomer in groupCompany select new XElement( "Customer" , subCustomer.LastN

Formatting ASP.NET Web Forms Panel as Bootstrap Modal Dialog

Here's how you make use of the asp.net panel container that will serve as modal dialog. During render, panel will be converted to div elements. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <asp:Panel ID= "pnlModal" runat= "server" role= "dialog" CssClass= "modal fade" > <asp:Panel ID= "pnlInner" runat= "server" CssClass= "modal-dialog" > <asp:Panel ID= "pnlContent" CssClass= "modal-content" runat= "server" > <asp:Panel runat= "server" class= "modal-header" > <button type= "button" class= "close" data-dismiss= "modal" > <span aria-hidden= "true" > &times; </span><span class= "sr-only" > Close </span> </button>

WIndows Forms Linear Gradients In C#.NET 2D

Image
Hi, Here's a simple demo using Linear gradients (Color Manipulation) in C#.NET Windows Forms. private int _rColor = 100; public int GenerateRGB( int cc) { int rt = 0; if (cc <= 255) { rt = Information.RGB(255, cc, 0); } else if (cc < 511) { rt = Information.RGB(255 - (cc - 255), 255, 0); } else if (cc < 766) { rt = Information.RGB(0, 255, cc - 511); } else if (cc < 1022) { rt = Information.RGB(0, 255 - (cc - 767), 255); } else if (cc < 1277) { rt = Information.RGB(0, 0, 255 - (cc - 1022)); } else { rt = Information.RGB(0, 0, 0); } return rt; } private void timer1_Tick( object sender, EventArgs e) { this .Refresh(); _rColor += 1; if (_rColor > 1500) { _rColor = 0; } } private void Form1_Paint( object sender, PaintEventArgs e) { Color color = new Color(); Random m_Rnd = new Random(); color = Color.FromArgb(255, m_Rnd.Next(0, 255), m_Rnd.Next(0, 255), m_Rnd.Next(0, 255)); using (LinearGradi

Cannot connect to WMI provider. You do not have permission or the server is unreachable In SQL Server 2012

Image
Hello, When you click on SQL Server Configuration Tools after pc reboot, you might encounter an error stated by the title of this post. Given the following details OS: Windows 7 Enterprise 64 Bit Software: SQL Server 2012 Network Setup: Domain Controller The steps to resolve the issue is presented below: 1. Right click command prompt and select "Run as Administrator" 2. Type the following in the command prompt C:\ mofcomp "%programfiles(x86)%\Microsoft SQL Server\110\Shared\sqlmgmproviderxpsp2up.mof" (where 110 is the number) Note: For this command to succeed, the Sqlmgmproviderxpsp2up.mof file must be present in the %programfiles(x86)%\Microsoft SQL Server\number\Shared folder. Sample Error Message: Cheers! :)

ASP.NET Web Forms Using Master Page Not Found On Visual Studio 2012 IDE

When the RTM versions of Visual Studio 2012 were updated to version 4, I noticed that when you Add a New Item in an Asp.net website or project, "Web Form Using Master Page" has gone missing. I soon realized that Web Form Using Master Page is replaced with "Content Page" in the Add New Item Dialog. :)

Webbrowser Control Imitate Internet Explorer Behavior

Image
Hi, Lately, I was given a task from a client if I can update my VB.NET crawler scripts with a webbrowser control to show/render images of the crawled website to the control. Normally, I used the control just to obtain the web page source and then parse the necessary information. By default, the settings of the webbrowser control is IE7. After doing some reseach, I stumbled upon a solution by Noseratio on IE Feature Control Hacks . The documentation for browser emulation can be found on MSDN: MSDN Browser Emulation . I uploaded a sample VB.NET application here: WebBrowser Control Similar to IE Browser Sample Result: Cheers! :)

List Running Computer Processes By Array Names Using LINQ In C# And VB.NET

Image
Here's a snippet on how to retrieve running process in your computer by array names using LINQ. C# Code 1 2 3 4 5 6 7 8 List<Process> procs = new List<Process>(); procs = new List< string >() { "firefox" , "iexplore" , "ssms" , "notepad++" , "chrome" } .SelectMany(o => Process.GetProcessesByName(o)).ToList(); foreach ( var item in procs) { Console.WriteLine(item.ProcessName); } VB.NET 1 2 3 4 5 6 Dim procs As IEnumerable( Of Process) = _ { "firefox" , "iexplore" , "ssms" , "notepad++" , "chrome" }.SelectMany(Function(proc) Process.GetProcessesByName(proc)) For Each p In procs Console.WriteLine(p.ProcessName) Next Console.ReadLine() Output

WPF DataGrid Row And Cells Extension Methods In VB.NET

Image
Below are extension methods in accessing WPF DataGrid Rows and Cells. These methods were based on existing C# methods and I converted them to VB.NET for VB programmers. WPF DataGrid Extension Methods: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 Option Explicit On Option Infer On Imports System.Runtime.CompilerServices Imports System.Windows.Controls.Primitives

Show Asterisk Triangle Shapes Using TSQL In SQL Server

Image
In programming, it's a common exercise to show triangle shapes using the asterisk character. Well, this can be achieved using TSQL as well. Script #1 DECLARE @Total1 INT DECLARE @ctrOuter1 INT DECLARE @ctrInner1 INT DECLARE @strPrint1 VARCHAR(100) SET @Total1 = 5 SET @ctrOuter1 = @Total1 SET @strPrint1 = '' WHILE @ctrOuter1 >= 1 --outer loop BEGIN SET @strPrint1 = '' SET @ctrInner1 = 0 WHILE @ctrInner1 <= (@Total1 - @ctrOuter1) BEGIN SET @strPrint1 = @strPrint1 + '*' SET @ctrInner1 = @ctrInner1 + 1 END PRINT @strPrint1 SET @strPrint1 = @strPrint1 + CHAR(13) SET @ctrOuter1 = @ctrOuter1 - 1 END Output: Script #2 DECLARE @Total INT DECLARE @ctrOuter INT

Databinding ASP.NET 4.5 GridView With jQuery And Ajax

Image
Hi, Here's a simple asp.net program that performs adding of data to GridView control through jQuery and ajax. On page load, perform databinding on dropdown list and gridview using server side and code behind. And on client side, that is a selection change occurs in dropdown list, perform binding by adding table rows and columns to GridView. Page Load (Load All Products): Selection Change (Load Specific Products): The sample code is available for download here: Databinding ASP.NET 4.5 GridView with jQuery and Ajax Code Cheers!

Donate