.NET Programming





The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

Share tech news, updates, or what's on your mind.

Sign up to Post

While attempting to install an older application onto a recently upgraded Windows 10 Pro computer, it requires the .Net Framework 3.5 to be installed.  When attempting to install it, I receive an error message 0x8024401f.  Is there a solution for this?
I've heard that .NET 5 is coming out next year and will supersede .NET Framework and .NET Core.
Will it be backwards compatible with both?
I'm using MailKit and MimeKit in my VB.NET application to send out emails. In order to do this, the end user must configure settings like SMTP Server, Port, etc.

All of the end users have email clients installed, like Outlook or Thunderbird. Is there some way for my program to use the same credentials as those installed clients without the user having to enter them again? I'm assuming the answer is no, but wanted to ask those more experienced in this sort of thing.
I am looking for a log provider for our .net core api.
But the only requirement is those logs should be able to view online. so that developers don't to depend on some log file or something.

Please suggest some if there are any. I googled it but did not find any such
ASP.net Web Work In Visual Studio How To Create an Efficient and FAST Setup To Develop...

Open to Any and All Tips that will help me develop DotNet websites faster and easier in Visual Studio...

So FAR... I do the following to be fast/efficient using VStudio .net coding  (not saying this is best or right way --  just providing a starting point)

I have THREE monitors...

Left Monitor has my CSS page and a minimized SQL Server Studio Management Software With my databases and tables to create update etc.

Middle Monitor has Visual Studio 2015 with HTML & ASP.net objects & Code Behind Page + HTML objects and Bookmark folder on my browser with links to
              StackOverflow, Microsoft Docs, and a lot of other DotNet resources... etc.

Right Monitor has Webpage(s) i am working on to see updates made in CSS or Code or HTML or where ever... and interactive web page cheat sheets minimized.

I have a notebook with Cheat Sheet for HTML and CSS printed out from helpful websites... mostly memorized but at my hand if needed

I have chrome developer tools ready to use to help see my or others CSS / HTM code development and to debug... Looking into to Firebug for JS debugging...

I use the Visual Studio block commenter buttons - for comment out comment in actions - to speed up  large comment in or out efforts

I use the Find button inside Visual Studio to see if CSS styles are being used or not in my HTML by searching ALL open …
Hi there.

Another question in my self-study of vb.NET:

I just tried deleting a control on a form, and I double-clicked a control because I wanted to add some vb-code. Later I deleted the control, but then I see, that the vb-code remains even though the control is gone.... and of course that causes a compiling error.
Is there a setting to automatically delete the related vb-code to a control, if the control is deleted?

Best regards

Hi there.

I have a new issue in my learning process with VB.NET. When I edit the behind code for a page, it works as intended when I test on local host. But when I publish to the web-hotel is doesn't work.
I can't see the aspx.vb files on the server? Can anyone tell me if these "behind code" files that are to be found on my computer/project-folder goes to the server in another way like a dll-file? I know this is basic stuff, but I gotta figure it all out to proceed with the real stuff.
Thanks in advance for your help. :-)

Best regards

I have a c#  application and need to return 2 items from a class  library

when i had 1 item i was able to return it but some how i am having error returning 2 items

The 2  items i want returned are   RegisteredStatus  and RegisteredLevel

Both variables  were defined as  strings  ie

string RegisteredStatus = "";
string RegisteredLevel ="";

After  some processing  in the script ,  I have values in both variables which i want returned.

1. Part of my code in the Library

  MyActiveLock.KeyStoreType = ActiveLock3_6NET.IActiveLock.LicStoreType.alsFile;

            MyActiveLock.Acquire(ref strMsg, ref strRemainingTrialDays, ref strRemainingTrialRuns, ref strTrialLength,
                   ref strUsedDays, ref strExpirationDate, ref strRegisteredUser, ref strRegisteredLevel, ref strLicenseClass,
                   ref strMaxCount, ref strLicenseFileType, ref strLicenseType, ref strUsedLockType);

            if (strMsg != null && strMsg.Length > 0) //There's a trial
                RegisteredStatus = "Trial Mode";
                RegisteredLevel = strRegisteredLevel;

                //cmdKillTrial.Visible = false;
                //cmdResetTrial.Visible = false;
                RegisteredStatus = "Registered";
                RegisteredLevel = strRegisteredLevel;        
            return (RegisteredStatus, RegisteredLevel);

Open in new window

Return RegisteredStatus   worked  fine,  while Return (RegisteredStatus, RegisteredLevel) gave a syntax error

I  introduced  the Tuple below into library hoping it would help me return the 2 values

But i think i might not be calling/using the tuple properly  (see Below the tuple in the library)

2. A Tuple also defined in the Library

public static Tuple<string, string> Location(string RegisteredStatus, string RegisteredLevel)
            return new Tuple<string, string>(RegisteredStatus, RegisteredLevel);

Open in new window

3. Eventually in my application i need to get the 2 returned variables in to

some text field on the screen .

For the 1 variable   which worked  my script was

 ActiveLockProcessor processor = new ActiveLockProcessor();
 txtRegStatus.Text = processor.GenerateActiveLockStatus();

What would be the correct syntax now for getting the 2 variables to my Text fields on screen

Please NOTE that i do not have to use Tuples if there is a simpler and more straight way to achieve this.


How to generate Click Once Deployment file .exe without depending on .application file?

I have created Click Once Deployment file. It works great.

However, .exe file was created along with .application file and Application Files - Folder which has necessary files.

.exe file works only if it is available along with .application file in the folder. If i share the .exe file without .application file to another user, it throws an error as follows ..

How to make the .exe file independent without depending on .application file?

+ Downloading file:///C:/Users/MyAccName/Downloads/MyProject.application did not succeed.
        + Could not find file 'C:\Users\MyAccName\Downloads\MyProject.application'

Open in new window

convert .aspx to .doc maintain header footer positions
Hi there.

I started working on a new VB.NET project. It's my first real attempt to make a .NET project. I used classic asp in the past, and all those files is tricking me. This is the case:
At my hosting company I have some old projects stored. In the www-folder (the root of my webserver) I have subfolders with projects, and this new .NET has got a folder too.
Now when I try to publish my very first page, I get an error message with compiling.
When I publish my project, the web.config ends up in the project-folder. Not in the www.root. So I moved it manually to the root on the server, but I have the feeling that it's not the right thing to do.
Can anyone please guide me how to do the publishing correct? Let me know if you need more info.

Best regards


I have a database column which is the arrival time of the patient to the clinic as TIME(7) data type.

I am struggling in viewing it to the data grid view column.

public string ArrivalTimeFormatted { get { return ArrivalTime?.ToString("hh\\:mm\\:ss"); }}

Open in new window

How can I add PM, AM to the ArrivalTimeFormatted property?

Hi All,

I'm trying to expand programmatically an accordion menu based on saved values in local-storage.
The problem is that it saves the values, i get back the values, but it's not expanding the active ones.
I use the following accordion library:
         accordion: function() {       
            return this.each(function() {
            	var $ul = $(this);
					return false;
				$.each($ul.find('ul, li>div'), function(){
					$(this).data('accordiated', true);
				$.each($ul.find('a'), function(){
						return void(0);
				var active = (location.hash)?$(this).find('a[href=' + location.hash + ']')[0]:'';

					activate(active, 'toggle');
				function activate(el,effect){
					$(el).parent('li').toggleClass('active').siblings().removeClass('active').children('ul, div').slideUp('fast');
					$(el).siblings('ul, div')[(effect || 'slideToggle')]((!effect)?'fast':null);

Open in new window

My HTML (i generate the menu from C#) + JS: Init that gets the menus/submenus that i clicked earlier (but not expanding them :o(   ):
<div id="pageWrap" class="pageWrap">
	<div class="pageContent">
		<ul class="accordion">

Open in new window

I have a .resx file in my resource folder. I'm trying to use ResXResourceWriter but it requires a path to the file. When I'm debugging I can just put a path to the file in my projects resource folder, but when it comes time to release the application it won't work since the application should only be one .exe file without any folders or additional files. I'm trying to do
ResXResourceWriter resx = new ResXResourceWriter(Properties.Resources.[File Name])

Open in new window

but it only seems to give me an error "Illegal characters in path."
I am a C# programmer. I'd like to start learning ASP.NET, but before that I'd have a couple of questions:

1. Should I learn ASP,NET Core or ASP.NET MVC? (What I need is to dynamically reformat pages on an existing web, at request, and also to provide user feedback forms that should access a database.)

2. I have on location an old Windows Server 2003 and another 2008, which I thought of using for testing samples. Can the framework required by ASP.NET Core be installed on such older servers? Would older IIS handle the job?

3. This book "ASP.NET Core in Action" is recent but some readers complain it's too verbose. Would you recommend another book/tutorial?

I have a solution with 2 projects. I want to build/compile one project from another. To be more exact I want a user that will be using ProjectNR1 to enter the information then the information should be passed to ProjectNR2 and then the project(ProjectNR2) builds/compiles. So the question I have is: How to compile a VisualStudio 2019 project programmatically using C# (It's a windows forms application). I have been trying to figure out this all day with no luck.
I am looking for the best DB giving the following considerations.

1)  I will be deploying a .net /angular application into Azure via Docker / Kubernetes.

2)  I would want on prem and cloud capabilities..natively

3)  Finally we will be moving to AWS in the next year..so migration is important as well.

I will want to use relational database.  High availability, on prem and off prem  capabilities, as well as other great scaling capabilities.

Also having a hard time with the cost model here...so any knowledge there would be helpful.

I will be doing this in a CI/CD ...I am guessing I would have docker in my local enviornment (free)  then move to a dev / stage/ prod enviornment.
in the code bellow I'm trying to remove 1080p | HD either in or out of ()
I butl the using regexq101
this appears to work except for last witespace
however I'm not getting the expacted reults

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;

namespace Remove1080p
    class Program
        static void Main(string[] args)
            string Root = "";
            Console.WriteLine(@"Drag folder");
            string Ans = Console.ReadLine();
            if (Ans == "")
                Console.WriteLine("Need a folder");

                Console.WriteLine(@"Drag folder");
                Ans = Console.ReadLine();
            if (Ans != "")
                Root = Ans;
                if (Root.EndsWith(@""""))
                    Root = Root.Trim(new char[] { '"' });
                    Console.WriteLine("trimed " + Root);
            Regex regex = new Regex(@"(\s+(\(1080p\s+HD\))|(\(1080p\)|(\(regex\))|1080p|720p|HD)\s+)");

            string[] Files = Directory.GetFiles(Root);
            foreach (string file in Files)
                Console.WriteLine("File " + file);
                FileInfo fi = new FileInfo(file);
                string Ext = fi.Extension;


Open in new window


Hi, I am using this online solution for Grideview Drag and Drop asp.net web forms (https://www.aspsnippets.com/Articles/Reorder-GridView-Rows-Drag-and-Drop-ordering-of-GridView-Rows-using-jQuery-in-ASPNet.aspx).  Everything works fine but now I need help updating the database table with additional fields.  For example:  I need to update the table of who dragged and dropped the row.  I added the "UpdateBy" field to my update statement , it works, but it updates every row with the value not the one row that was dropped.  What am i missing? Please need help asap.


  Private Sub BindGrid()
        Dim query As String = "SELECT [id], [DisplayOrder], [STUDY], [PATIENT],[WAIT_TIME],[USER_ID],[UpdateBy] FROM [Radio_queue4] " +
"order by DisplayOrder asc"
        Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
        Using con As New SqlConnection(constr)
            Using cmd As New SqlCommand(query)
                Using sda As New SqlDataAdapter()
                    cmd.CommandType = CommandType.Text
                    cmd.Connection = con
                    sda.SelectCommand = cmd
                    Using dt As New DataTable()
                        grid.DataSource = dt
                    End Using
                End Using
            End Using
        End Using
    End Sub

 Protected Sub UpdatePreference(sender As Object, e As 

Open in new window

I am learning angularjs , and have mostly worked in .net space.

what are few ways/tools/tips/tricks to debug angular code?
Hi All,

I have a .net core web api app that services iOS and Android mobile devices. Then i have an asp.net core MVC web app but im wondering about breaking this out into its own angular/vue/react app that consumes the .net core web api. The current MVC web app is where users can change password, change email preferences, etc.

What are the pros and cons of this? I feel like it will allow us to consume more functionality of the .net core web api into our webapp which is really basic right now.

I am trying to get a range of cells from a sheet to populate my graph on a different sheet inside my excel workbook. When it hits the line "  chartRange = oWB.oSheet("Sheet1").Range("A1", "A136")" It throws an error "System.MissingMemberException: Public member osheet on type Workbook not found

What is wrong with that line of code?

 Dim oXL As Excel.Application
        Dim oWB As Excel.Workbook
        Dim oSheet As Excel.Worksheet
        Dim oRng As Excel.Range
        Dim ValueTemp As String
        Dim oChart As Excel.Chart
        Dim MyCharts As Excel.ChartObjects
        Dim MyCharts1 As Excel.ChartObject

        ' Start Excel and get Application object.
        oXL = CreateObject("Excel.Application")
        oXL.Visible = True

        ' Get a new workbook.
        oWB = oXL.Workbooks.Add
        oSheet = oWB.ActiveSheet

        'Add a new Sheet.
        oSheet = CType(oWB.Sheets.Add(Count:=1), Excel.Worksheet)

        'change page orientation
        oSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape

        oSheet = oWB.Worksheets.Item(2)
        Dim intRowLoc, intcurrentrow, intCurrentCol, intLoop, intOuterLoop, intInnerLoop As Integer
        Dim boolRowFound, boolNextRow As Boolean
        intcurrentrow = 1
        intCurrentCol = 1
        For intInnerLoop = 0 To 135 'Column4.Count - 1
            ValueTemp = (Column4(intInnerLoop)).ToString
            oSheet.Cells(intcurrentrow, intCurrentCol) = ValueTemp

Open in new window

Is, at least some of, the thought of the .NET framework the ability to create a piece of software that doesn't require installation?

I would like to make a program that just runs. I have VS 2017.

I'm under the impression that I am correct... that is until you get to the point of using references that may need to be registered, etc.

At the end of the day I am familiar with C# and VB and would like to make a program that doesn't need to be installed and just runs. I would need to know the boundaries, or where the point is of "ok... now you have to install".

How can I add a series of 256 points to an Excel chart ? I have the code below however I can;t seem to find an add data property to the chart object?

Dim objApp As Excel.Application
        Dim objBook As Excel._Workbook
        Dim objBooks As Excel.Workbooks
        Dim objSheets As Excel.Sheets
        Dim objSheet As Excel._Worksheet
        Dim range As Excel.Range
        Dim chart As Excel.Chart

        ' Create a new instance of Excel and start a new workbook.
        objApp = New Excel.Application()
        objBooks = objApp.Workbooks
        objBook = objBooks.Add
        objSheets = objBook.Worksheets
        objSheet = objSheets(1)
        objApp.Visible = True
        objApp.UserControl = True
        'Add in Header Graph.
             Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 0, 45)
        'Add in DataChart

Open in new window


I have a byte array
byte[] newBytes

Open in new window

It contains
[0] 48
[1] 48

Open in new window

I know that this should equal 00
How do i get that into an int?
i've tried
var num = BitConverter.ToInt16(newBytes, 0);

Open in new window

but i get 12336 out of that

.NET Programming





The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.