Click here to Skip to main content
15,888,579 members
Everything / .NET / .NET4.5

.NET4.5

.NET4.5

Great Reads

by David Rogers Dev
Learn how to load related entities using the Entity Framework with simple examples
by The Ænema
This article will teach you how to create an amazing, clean and smooth WPF/Winform UI for your native application without using any complex, unsafe, ActiveXish methods, etc.
by tetsushmz
This article explains how to dynamically create RDLC.
by Daniel Vaughan
Create best-in-breed cross-platform MVVM apps using Calcium for Xamarin.Forms.

Latest Articles

by Sufyan S Jabr
All that you need to know when working with MSDTC, troubleshooting and problem solving.
by Alexey A. Popov 2
A simple implementation of Miller columns (cascading columns) control
by chris_mackay
A reference for writing your own dialog message box in Windows
by #realJSOP
A rewrite of a previous article with more liquid nitrogen and bacon

All Articles

Sort by Updated

.NET4.5 

8 Feb 2024 by Richard Deeming
WebForms link/image buttons are implemented by calling some JavaScript when you click them. But you have added JavaScript before that which unconditionally returns true/false, meaning that this code will never be called. If you view the source...
8 Feb 2024 by Herman<T>.Instance
Hi Folks, in my asp:GridViewcomponent I have the DeleteMethod setup. Also CommandField is set up:
22 Jan 2024 by Dave Kreskowiak
First, the Win32_DiskPartition class does not have a "DriveLetter" property, that query is going to fail every time. Next, drive letters are Logical Disks, not physical ones. A single physical disk can contain multiple logical disks, each...
22 Jan 2024 by johnjsm
Function GetDiskPartitionType(diskDrive As String) As String Dim upperCaseDiskLetter As String = diskDrive.Substring(0, 1).ToUpper() Dim wmiQuery As String = $"SELECT DiskNumber, GptType, MbrType FROM MSFT_Partition WHERE...
22 Jan 2024 by johnjsm
I'm trying to get the partition layout/scheme of a USB disk using the drive letter. I'd like to find out if the disk is MBR or GPT. I can use Powerhell but it takes too long to get information back. I have looked at MSFT_Disk and MSFT_Partition...
18 Dec 2023 by pasztorpisti
There are too many scenarios to cover so it is impossible to answer you question. But, using more active threads than the number of cores is usually counterproductive. You can benefits from using more threads than the number of cores only if...
6 Oct 2023 by kami sato
I am able to generate XML file paths and shortening the path to only file name in the listbox, but I am unable to generate the XML to the datagridview. What I have tried: private void ReadDropperScheduleFiles() { string...
9 Aug 2023 by Member 16041854
Hello!! If I use printpreviewdialog1.showdialog(), it works perfect. But if I use printpreviewdialog.show(), it shows empty. Is anyone having the same issue or have an idea why it happens? Thank you. What I have tried: I am using The...
9 Aug 2023 by FcoJimenez
Thanks OriginalGriff and Andre for your help. I found the solution. It was something wrong in the document.printpage. I am working on a Cattle Managment Software, with a tab control. tabpage 0 : Home Page tabpage 1 : Cow Information (2...
2 Aug 2023 by Andre Oosthuizen
The reason why the 'printpreviewdialog1' shows up is because it is the named control derived from the actual control 'printpreviewdialog' Class - see full explanation and sample code - MS Learn | PrintPreviewDialog Class[^] The object will be...
1 Aug 2023 by OriginalGriff
We have no idea what the "DATAGRIDVIEWPRINTER" class is, or how it works: it is not a standard .NET class and we have no idea where you got it from, or how it works. Moreover, we have no idea how you ar eusing is, since we can't see your screen,...
27 Jul 2023 by Ralf Meier
Perhaps this Link helps you : https://stackoverflow.com/questions/13318852/how-to-change-background-color-of-a-comment-inserted-in-ms-word-document[^]
26 Jul 2023 by cmarcotte
Your code show nothing relative to colors. And, Word has absolutely no way to know if a text represents code or something else. In word a colored text is nothing more, or less, than a black test. It is just a color. Word cannot make any...
26 Jul 2023 by Harikavulli
Hi,I have to alert user about red lining comments before processing the word document. I am able to loop through comments in the word document but could not find a way if the lines are red (the document has both red lines and blue lines for the...
26 Jul 2023 by Richard MacCutchan
You probably need to examine the Properties of each individual comment: Comment Interface (Microsoft.Office.Interop.Word) | Microsoft Learn[^].
24 Jun 2023 by Member 11728887
I've created an ugly looking windows forms application for testing the methods of classes I'm creating for another application. I've got a panel which will be filled with controls for each parameter. For a parameter for the List type I'm using...
24 Jun 2023 by Member 11728887
I was a bit impatient (and lazy) and asked ChatGPT (AI). Together we came up with the following solution: private void btnTestMethod_Click(object sender, EventArgs e) { InvokeMethod(); } private void InvokeMethod() { try { if...
30 May 2023 by Sufyan S Jabr
All that you need to know when working with MSDTC, troubleshooting and problem solving.
20 Apr 2023 by Leo Bois
I have the following xml file : Tempete 1 ...
4 Jan 2023 by Alexey A. Popov 2
A simple implementation of Miller columns (cascading columns) control
3 Jan 2023 by Member 10376725
I have an app that keeps track of all my DVDs. The DVDs are also digitized so they can be played right from the app. When I go into the app, I need to be sure that I am in the same drive as the digitized movies. So far, I have been just manually...
1 Jan 2023 by Member 10376725
Graeme_Grant, you are correct, adding a few lines of code proved to me that the directory was changed. But when I run the program and the directory that appears is ALWAYS another directory and always the same directory. So, first I changed the...
30 Dec 2022 by ahmed_sa
I work on a web application with ASP.NET Core 6 and Angular 13. This application displays a list of items successfully without any issue. My issue How to Add Previous and Next buttons Pagination using Angular 13? What I have tried: What I...
30 Dec 2022 by Sandeep Mewara
Web seems to have many examples like: Angular 13 Pagination example (server side) with ngx-pagination - BezKoder[^] Above article demonstrates example using ngx-pagination provides NgxPaginationModule for displaying pagination with numbers and...
30 Dec 2022 by Graeme_Grant
You could write a windows service[^] that stores the date & time every minute in a specific file. Then your reporting app can use that information. UPDATE Maybe you are looking for Logged in/out session information. This may help: How to get...
30 Dec 2022 by DoingWork
I am reading LastBootUpTime by following method but it displays few days old time while I shutdown my PC on daily basis. I know the solution described in this link Windows 10 LastBootUpTime not updating[^] but enforce each user to change system...
30 Dec 2022 by OriginalGriff
The last boot time is probably correct - it's just your idea of what you do with your computer that differs from Windows. With Win 10 / 11 (and maybe earlier, I'm not sure) "shutdown" and "restart" don't do what the name implies, not really -...
28 Dec 2022 by Amerigoware
I am using the following code to load the ListView and ImageList: Code: 'Populate screenshots ScrnShtDirLbl.Text = ScrnShts ToolTip1.SetToolTip(ScrnShtDirLbl, ScrnShts) ScrnShtsLst.Items.Clear() ...
28 Dec 2022 by OriginalGriff
Image.Clone creates a copy of the Image object, but the actual image data is shared between the two images until you write to it! That may sound weird, but I suspect it's a performance thing - the long-winded operation of copying the actual...
27 Dec 2022 by Graeme_Grant
Are you sure that it did not work? does the drive exist? I did a quick check with a mapped drive on my system: Console.WriteLine($"Current: [{Directory.GetCurrentDirectory()}]") Directory.SetCurrentDirectory(@"m:\") Console.WriteLine($"Current:...
26 Dec 2022 by ahmed_sa
I work on a web application with ASP.NET Core 6 and Angular 13. This application displays a list of items successfully without any issue. My issue happens when there's pagination for the items displayed. I get an error in the console: ERROR...
17 Dec 2022 by RickZeeland
A popular method is SCRUM, see: What is Scrum? | Scrum.org[^] This method is not suitable for all development shops however, but might be suitable when you can do "sprints" in a month or less. I would also recommend using an issue tracking tool,...
16 Dec 2022 by OriginalGriff
Wrong site: this site is devoted to software development, not management strategy. Try and find a more relevant site if you can, or get a book on team leading and read it. Personally though, "the boss keeping out of the way" is 90% of what...
5 Dec 2022 by Ridhdhi Vaghani
How to add histogram tool in visual studio windows application? What I have tried: How can I do use a histogram tool and how to add histogram tool ?
5 Dec 2022 by OriginalGriff
Use the Chart control: Chart Class (System.Windows.Forms.DataVisualization.Charting) | Microsoft Learn[^] there are plenty of tutorials showing how to use it: Chart Control C# - Google Search[^]
4 Dec 2022 by ahmed_sa
I working on .net 5 mvc i have table name cinimas have 5 rows . my issue I can't display these 5 rows on custom view model . I try but no rows display what I try 1- model creation public class Cinema:IEntityBase { [Key] ...
4 Dec 2022 by Richard Deeming
Quote: I check this to return data from model direct it return 5 rows as below as below: var cinmas2 = _context.Cinemas.ToList(); but from view model on step 4 as below no rows displayed: public IQueryable GetAllCinimas() { ...
24 Nov 2022 by ahmed_sa
I work on csharp webapi .net core 6 i need to pass number integer id with object but i don't know how to do on post man put method request [HttpPut("{id}")] public async Task Update(int id, UpdateItemCommand command) ...
24 Nov 2022 by Richard Deeming
The ID parameter is part of the route. The URL for your request needs to look something like: https://localhost:7235/api/items/42
20 Nov 2022 by ahmed_sa
I working on csharp i need real example of using delegate with event� example meaning scenarios and situations i must use delegate and event on it� What I have tried: public delegate void MyDelegate(string msg); // declare a delegate
20 Nov 2022 by Graeme_Grant
The Microsoft documentation has many examples and explanations beyond what we can offer here: Handling and Raising Events | Microsoft Learn[^] (I have checked and delegates are covered)
2 Nov 2022 by RickZeeland
Maybe you can find an example here: Search CodeProject PGP[^] This might be the solution to your problem: PGP Decryption - Unnecessary exception stops execution · Issue #143 · bcgit/bc-csharp · GitHub[^]
1 Nov 2022 by runtime_terror
Hi, I am trying to encrypt a file using a public key (e.g. abc_public.asc) generated through PGPTool, which was shared with the client. The client shared a private key (xyz.asc) in return, in which the PGPTool shows as 'Public' (xyz.asc) and 'Key...
8 Sep 2022 by Member 15741700
I want to enable wmi services in firewall on remote host machines using vb.net for the command line using win32 class. i can't find out the error. What I have tried: Private Sub Button3_Click(sender As Object, e As EventArgs) Handles...
14 Aug 2022 by ahmed_sa
I work on csharp i get error object reference not set to an instance of an object code give me error ElasticPartialUpdat.Create.error.get returned null. so how to solve error please ? What I have tried: var Data = result.items.Select(e =>...
14 Aug 2022 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a...
12 Aug 2022 by lalitjoshilalit
0 We are using mentioned package in our project and suddenly getting the below error in Azure build pipeline. The NuGet command failed with exit code(1) and error(Unable to find version '1.1.2' of package 'Kendo.DynamicLinq'....
12 Aug 2022 by lalitjoshilalit
Thanks @Richard Deeming. I had found below package to fix this issue. There is a GitHub repository for the package: GitHub - kendo-labs/dlinq-helpers: Add server paging, filtering and sorting via Dynamic Linq[^]
9 Aug 2022 by Richard Deeming
There is no such package on NuGet: NuGet Gallery | Packages matching Kendo.DynamicLinq[^] The only results are: wilx.Kendo.DynamicLinq.Core, Codout.Kendo.DynamicLinq, and KendoNET.DynamicLinq. There is a GitHub repository for the package:...
27 Jul 2022 by Tshilidzi Maemu Nembilwi
List all the training registrations for all the courses. The following information should be displayed. ✓ A list of all courses and their training registrations. After every course training iteration, display a list of all delegates registered...
27 Jul 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
26 Jul 2022 by ahmed_sa
ProblemHow put image logo inside of generated bar code ?DetailsI make windows application to generate c# qr codeI success to do thatI work in visual studio 2015 windows form applicationsi using messagetoolkitqrcodeMy code generated qr code by c# as following...
26 Jul 2022 by Member 15674854
Creating a class: public class QRCodeEncoderDemo { public static System.Drawing.Bitmap CombinImage(System.Drawing.Bitmap bit,string destImg) { System.Drawing.Image img = System.Drawing.Image.FromFile(destImg); ...
21 Jul 2022 by Muthu vj
HI I am Using Visual Studio 2008 . now i am trying to Connect the Oracle Database and Execute my WCF service. i am facing this Error while Execute it can you Help me on this. What I have tried: Oracle.DataAccess.Client.OracleException: The...
21 Jul 2022 by Maciej Los
Please, install proper version of Oracle connector! See: Oracle Data Provider for .NET Versioning Scheme[^]
19 Jul 2022 by Reza jafery
Finally, I found a solution that does not have the above problems. I made a strategic mistake. When we connect DataGrid.ItemsSource to DataView or CollectionViewSource.Source for the first time, the values of DataView and...
17 Jul 2022 by Reza jafery
I give credit to whoever answers this question by posting the output. If my country's banks were not sanctioned, I would give a gift to the individual who answered this question (I've been looking for an acceptable response for months). I want...
14 Jul 2022 by Ali Khan 3
I have a datetimepicker named (DTPEntryED) and textbox named (TxtLengthoSED). when i run the program and select any date for example 24/01/2012 and want to know the difference between that date and today i.e 15/07/2022 it gives me a result as (10...
14 Jul 2022 by OriginalGriff
Ignore Maths, and DateDiff: use a TimeSpan[^] You are mixing up very old VB (VB6 and earlier!) constructs with the newer .NET versions, which is never a good idea. If you subtract two DateTime values, you get a Timespan: Dim dt As DateTime = New...
13 Jul 2022 by Graeme_Grant
Simply use an ObservableCollection as the ItemSource. The DataGrid them becomes the "View" into the data. Now simply removing items from the ObservableCollection will be reflected in the DataGrid.` Here is a simple example: 1. Class to hold a...
7 Jun 2022 by JimmyWelch
I have an old .net Framework assembly project that uses a SOAP Web Reference. These references were created via right clicking on references - Add Service Reference - Advanced - Add Web Reference. The SOAP Web Service is now requiring oAuth...
7 Jun 2022 by Jim Welch 2022
Found the answer here: c# - Adding Authorization Header to Web Reference - Stack Overflow[^]
18 Apr 2022 by cd_n
I am trying to destroy the shadows from the image.I found an algorithm that is called linear shading algorithm but I am not good at applying the formulas to the code and I have difficulty in implementing it to the code. Here is the explanation of...
31 Mar 2022 by ahmed_sa
zip files not downloaded on angular 13 although zip files created and api not give error ? I work on application asp.net web api core 2.2 and angular 13 . I make web api compress files and create it first as zip files . then downloaded on my...
21 Feb 2022 by Member 15542635
// this is my stored precedure private string LastPlanDate(string WPMID, string SchoolAcaID, string SchoolMasterID) { try { cT.WPMID = Convert.ToInt32(WPMID); cT.Schoolacaid= _objSession.schoolAcaID;...
21 Feb 2022 by OriginalGriff
That's not a stored procedure: that is C# code and stroed procedures are written in SQL, because that is where they are executed. This is a stored procedure: ALTER PROCEDURE [dbo].[spCountEpisodes] AS BEGIN SET NOCOUNT ON; SELECT a.Name,...
8 Feb 2022 by DoingWork
Failed to Install Deb package maker for .netcore apps on ubuntu[^] or Is there any alternate package maker ? .Netcore version: .Net5.0 Ubuntu: 18.04.6 TLS VSCODE : 1.64.1 OS: Linux x64 5.4.0-96-generic What I have tried: I have successfully...
1 Feb 2022 by Timi_z
Hi, I'm trying to find a solution for the following task, but I’m stuck. Please help me find a solution. The code is working fine for counting exact string match, but what I’m trying to achieve is to find and count words if they are not same...
1 Feb 2022 by Timi_z
I found a solution. I have added for each loop and replaced the question mark with all the char I needed from the array each time.
21 Jan 2022 by Patrice T
Quote: I would like to use ? for any char in between string if it appear on search textbox. You need to learn Regex better, '?' is not what you think it is. Try add.ress Count is 6, "Add.ress" is rejected because of uppercase. Just a few...
19 Dec 2021 by Leonel Masangcap
system.net.mail.smtpexception: Failure sending email. What I have tried: Good afternoon. Hope you are all fine. I just need some help regarding my project. Everytime i try to send email using vb.net code i am receiving the error below. ...
19 Dec 2021 by Afzaal Ahmad Zeeshan
Emails are a very notorious topic in software development, especially because they have different factors affecting the execution of your code—hostname, port, enable SSL, etc. Since you've not shared the code, my guess is either you're not...
17 Dec 2021 by ahmed_sa
I work on csharp i need to get value of period and Start date from variable productData so how to get data of start date and period from ProductData string variables using csharp string productData = Serial No :444909812 ItemType :Electricy User...
17 Dec 2021 by OriginalGriff
Try a Regular expression: (?:Start Date :)(?\d\d\d\d/\d+/\d+)(?:.+?End Date :)(?\d\d\d\d/\d+/\d+) Will split out the date info from your examples, and you can then use DateTime.TryParse to convert them to DateTime objects.
6 Dec 2021 by TarunKumarSusarapu
Hi Team, I am getting below error while running .net core project on Service Fabric Cluster. System.BadImageFormatException: 'Could not load file or assembly 'System.ComponentModel, Version=4.0.4.0, Culture=neutral,...
6 Dec 2021 by Sakthi Bala K.S
You have to add the package reference for "System.Runtime" by nuget package manager, fixed the binding redirects in app.config, and make sure that app.config and package.config have the same version for the assembly. However, the problem...
19 Nov 2021 by OriginalGriff
THis is the same problem - and indeed error message - that you asked about yesterday: Unable to get out parameter from oracle 19c[^] And as I said then: Quote: The string you are trying to load into the output parameter is too long to fit in the...
17 Nov 2021 by Member 15435237
Unable to get out parameter value from Oracle 19c where getting error as ORA-06502 : PL/SQL: Numeric or Value error : Character string buffer too small What I have tried: I have developed on POC where I have DB as oracle 19c and .Net...
17 Nov 2021 by OriginalGriff
If you get an error message you don;t understand, google it: ORA-06502 : PL/SQL: Numeric or Value error : Character string buffer too small - Google Search[^] The second link explains what causes the problem, and it's pretty obvious: ORA-06502:...
16 Oct 2021 by ahmed_sa
I Working on console application I ask why result is ClassB IT must be ClassC i executed app on console and it give me ClassB why final result ClassB i expect it will be ClassC What I have tried: using System; using System.Collections.Generic;...
16 Oct 2021 by OriginalGriff
It's because a is a ClassA variable: it only "knows" about ClassA and overrides in derived classes. In ClassB, the Print method is overridden, so when you try to call Print on a it searches for the highest level override it can find - but since...
16 Oct 2021 by Wendelius
Few things, you have defined the variable as classA. You create the object from ClassC but still the signatures are from ClassA because of the definition. So when you call the Print method it is executed from classB because it overrides the the...
19 Sep 2021 by Richard Deeming
Ignoring the (many) syntax errors in your code, if you're getting data for one list but not the others, then your data source is only returning data for one list. You need to debug your code to find out why. We can't do that for you, since we...
9 Sep 2021 by s yu
I run debugging on VS2015. For a string s = "F1"; Suddenly, I got such an error in "Immediate Window", as shown below: s.Contains("A") Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible,...
7 Aug 2021 by nor s
I have a VB.net (4.5.2) application that I want to use to resize a large number of JPg's from 2048 to 512 width in a batch type mode. I collect the file names in a list box and then index thru the list and resize each file and save it on the...
7 Jul 2021 by durmus
I have 3 firebird databases in my project. A master database and 2 slave databases. What I need to do is to save some records in the main database to the slave databases and I have to do this at certain times. For example, every 30 minutes... I...
30 Jun 2021 by Manidas Payyoli
Hi, i have some logical and architectural doubts here.I am stuck on some bad logic and architect.Somebody please help me to solve this issue.I have a dot net core 3.1 app.I need to loop through some testCasesCountand i need to� check and certify...
30 Jun 2021 by SAREKA AVINASH
[RegularExpression ("^[a-zA-Z-äöüÄÖÜß]+((['. -][a-zA-Z-äöüÄÖÜß ])?[a-zA-Z-äöüÄÖÜß]*)*$", ErrorMessage = "Invalid UserName")] public string FirstName { get; set; } Ex: San's123 Mon's -> Correct San's S4's -> Incorrect -> I dont need...
22 Jun 2021 by Member 11151914
we implemented a win form app with net framework 4.5.1 running in systems that runs a web app using net framework 3.5, when we install the 4.5.1 version, some of web app parts doesn't work correctly in some of windows(all the windows versions is...
22 Jun 2021 by Maciej Los
In addition to Richard's answer, there's a list of articles which states about backward compatibility and possible configurations: How to: Configure an app to support .NET Framework 4 or later versions | Microsoft Docs[^] Migration of .Net...
22 Jun 2021 by Richard Deeming
.NET Framework 3.5 and .NET Framework 4.x install side-by-side. Installing one will not alter the behaviour of applications written for the other. If it's breaking a web application, then you need to double-check that the CLR version selected...
16 Jun 2021 by ahmed_sa
I work on web api asp.net core 2.2 I face issue I can't return true or false from web api compare excel as below so if excel is identical then return true else return false public bool CompareExcel(string filePath, string templatePath, out...
16 Jun 2021 by Chris Copeland
Most of the work is already done in the controller, you just need to return the correct IActionResult from the controller method. This tutorial page[^] has some good examples of what you can return, you just need to see which one applies here.
14 Jun 2021 by Dinesh Kudale
In MainWindow.xaml: It is a 'Block1' tab window inside...
9 Jun 2021 by Emmery Chrisco
I'm trying to zip a folder and its contents. Using ZipFile.CreateFromDirectory("source", "destination.zip") zips the contents but not the containing directory. How can I achieve this? Note: I don't want to zip all the folders where the source...
9 Jun 2021 by Gerry Schmitz
Use the includeBaseDirectory option. Quote: includeBaseDirectory Boolean true to include the directory name from sourceDirectoryName at the root of the archive; false to include only the contents of the directory. ZipFile.CreateFromDirectory...
4 Jun 2021 by Member 11728887
I've got a custom control, "ButtonControl", which contains a property of a custom class "Corners". This class has four properties of the custom class "Corner", which has a value for the angle and the radius of a corner (both type int). Whenever I...
4 Jun 2021 by OriginalGriff
If I copy'n'paste your code into a new UserControl of an existing project, then comment out the unknown stuff, change the base class to UserControl and rebuild, I get no errors: using System; using System.Collections.Generic; using...
19 May 2021 by Chris Copeland
Realistically, no WPF doesn't really support embedding windows inside other windows. I believe Microsoft decided that having this sort of hierarchy (MDI) was bad practise, so generally the idea is that you create user controls for the content. ...
18 May 2021 by ahmed_sa
I work on visual studio 2017 asp.net core 2.2 when create new api controller I get Error There was an error running the template...