.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


We're in the process of refactoring a large PowerBuilder application with the goal of keeping our business logic in PB and exposing it as an API for .NET developers by using the .NET assembly target in PowerBuilder 12.6 Classic.

The environments we need to support include multi-threaded environments like IIS and xUnit.  In using xUnit (which defaults to running tests in parallel), we've encountered an issue where database connections made on separate threads are interfering with each other.  We've also reproduced this issue from a multi-threaded .NET console application.

We've created a very simple .NET assembly that just exposes a connection nvo that wraps a native PB transaction stored as an instance variable in the class.  We are not using SQLCA or any global variables.  The connection object just has connect and disconnect methods.  We import this assembly into a .NET xUnit project, create three separate test classes where each runs a test that instantiates a local connection instance and loops ten times, just connecting and disconnecting with each iteration.

If we force xUnit to run tests serially (see how below), we can repeatedly run all tests without issue.  If we let xUnit parallelize the execution of the three test classes, we get random errors.  Sometimes after connecting we'll get a "transaction not connected" exception when immediately trying to disconnect or when attempting to connect we'll get a "transaction already connected" exception.  …
NEW Veeam Agent for Microsoft Windows
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

I have a modalPopupExtender control with a Panel and inside the Panel I have an iFrame thats source is another form. This is the way my boss wanted it done. So in the other form where I have 3 different html tables. So whenever this form gets called up it will know which table  should be visible and which should not. This is all fine. My only problem is resizing my panel and iFrame. When the modalPopupExtender gets called the iFrame is either too big and the Panel too small or vice cersa. Now, in my calling form I have a procedure that checks the browser and sets the height accordingly(the width of the iFrame is set to 95% and that, for some reason, works?? But the height is my nemesis and, like I said, depending on which html table will show is dependent on the height that should be set.
This CANT be so hard that I have to deal with major gaps in my form/popup. It looks horrble. I have attached a pictures of the 3 different heights I need and Im hoping that someone can let me know what Im doing wrong and an easy way to go about fixing it...

FYI, the 3 pics I have attached are in IE and they are worse in the other browsers.
I can deal with 1 and 3 but the 2nd pic attached is unacceptable....

Thanks in advance....And anything needed from me please ask and I will send it right over

PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Problem 1Problem 2Problem 3
Below codes is to return .net datatable, and I use asp.net repeater to bind it. everything is working except the list does not sort by date and time. The data source starts from query3.

Not sure why. and hope some experts can help out.


var query3 = query1.Concat(query2).OrderBy(z => z.DateTimeSent);


public static DataTable GetConversation(string sid, string token,string accountPhoneNo, string twilioPhoneNo)
            string clientPhoneNo = string.Empty;
            string inputFilePath = filePathUserMessagesAll;
            DataTable dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[]
                new DataColumn("Body",typeof(string)),
                new DataColumn("DateCreated",typeof(string)),
                new DataColumn("Direction",typeof(string)),
                new DataColumn("SelectedPhoneNo",typeof(string))
            XDocument xdoc = null;
            using (XmlReader xr = XmlReader.Create(inputFilePath))
                xdoc = XDocument.Load(xr);
                var query1 = from t in xdoc.Descendants("User")
                             t.Element("From").Value.ToLower() == "+1" + accountPhoneNo.ToLower()
                             ) //client phone
                             select new

Open in new window

How can i highlight the cell border when clicked on it.

I am using vb.net 2015 desktop.

To map within the following, we double-click the map area to increase its size. What is the way to "decrease" it (for showing more area)?

I'm using Visual Basic in a Windows forms .net framework 4.0 application.

On load of my window I set a variable to the default value of this:

Dim TestVariable1 = "A"

I have a button called Button1 on my page.

I want to have the button toggle the value of my variable between 3 different values.

So if I click the button once then my variable is set to the following:

  TestVariable1 = "B"

If I click on the button a second time then my variable is set to the following:

  TestVariable1 = "C"

Then if I click the button a 3rd  time then my variable is set back to the following and the sequence starts over again:

  TestVariable1 = "A"

So then to summarize, on each button click , the button will rotate the value of my variable between "A", "B", "C"

Any ideas of how I would set up either a Visual Basic case or if else statement for this?
Hi There!

I have a customer who is a developer. They have 12 staff. 5 Developers 5 support people, 1 director and 1 sales/admin person.

They have an action pack, which covers up to 10 users of Exchange, Windows CALS etc, and that's fine.

What they are trying to do it make sure they are correctly licensed for dev machines, dev environments and testing labs.

It used to be that companies bought MSDN Subscriptions but I think those are now only for individuals and not for use in businesses at large? I had heard about MSDN Platforms but when I checked the pricing the customer just about died.

Anyone know of a more cost effective way for a company this size to correctly license their environment?
I have a series of ListBoxes I inherited. (Many)

I need to build a comma selerated string that I can pass into SQL Server

If a person selects Bob, Tim and Larry

strAccomName below would get built as

So that when I pass it ito SQL

It can be used  as
WHERE a.AccomName in (@strAccomName)

        For Each Item As ListItem In ddlAccomName.Items
            If Item.Selected Then
                strAccomName = strAccomName & Item.Value & ","
            End If

balh... blah... blah...
 oCom1.Parameters.Add(New SqlParameter("@strAccomName", SqlDbType.VarChar)).Value = strAccomName

blah... blah... blah...

I am also open to manipulating them on the SQL Server side.

I have  abc.zip which i unzipped and imported to eclipse as maven project.

Later i got updated version of abc2.zip. I extracted to differnt folder called new_folder. Now when i try to import abc2.zip i am getting error as

 Project wsdlfirstws already exists
 Add a version or custom suffix using "Name template" in "Advanced" settings

how to fix this error and import updated abc2 project
My previous application in VB6 would create a record using the code below:


Module basDeclarations

Public Const maxTables = 20

Structure Gametype
    <VBFixedString(6)> Public memberID As String
    Public TableID As Integer
    Public StartTime As Date
    <VBFixedString(1)> Public Occupied As String
End Structure

End Module


Public Sub CreateCurrentGamesFile()
    Dim OneGame As Gametype
    Dim TableNumber As Integer
    Open app.path & "\CurrentGames.dat" For Random As #1 Len = Len(OneGame)
    For TableNumber = 1 To maxTables
        OneGame.memberID = ""
        OneGame.TableID = TableNumber
        OneGame.Occupied = "N"
        Put #1, TableNumber, OneGame
    Next TableNumber
    Close #1
End Sub
End Class

How can I convert this block of code in vb.net to create new records as a random access file? Or Is there a better way to store records which can be easily saved and deleted in vb.net? Thanks

Please provide comments on your code
Want to be a Web Developer? Get Certified Today!
Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

newbie API developer here!  I created a .NET web API with XML payload--just a GET. I can run and use it on localhost. I built the solution, converted the folder to an app in IIS, but get a 404 error in the browser from my client using the external address. So https://localhost:60332/api/contact works on the dev server, but not https://my.domain.com/api/contact

What am I missing?
I'm generating a pdf from html with NReco PdfGenerator however there are 2 settings (Document Assembly and Page Extraction) that are set to Not Allowed. I've contacted NReco and they said ..."wkhtmltopdf doesn't support any PDF metadata options (PDF is produced "as is")." and went on to suggest that using iTextSharp should allow me to change these defaults to Allowed.

With the following code I've been able to change the Document Assembly but I've searched all over for the Page Extraction setting and nothing found.

            var htmlContent = InvoiceHTML;

            var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();

            htmlToPdf.CustomWkHtmlArgs = " --dpi 300 --disable-smart-shrinking";
            var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);

            var pdfBytesOut = new MemoryStream();
            PdfReader reader = new PdfReader(pdfBytes);
            PdfStamper pdfStamper = new PdfStamper(reader,pdfBytesOut);
            pdfStamper.ViewerPreferences =  PdfWriter.AllowAssembly;

            Attachment att = new Attachment(new MemoryStream(pdfBytes), "Invoice-" + getAllocation(LookUpInvoiceTypeid) + InvoiceNumber + ".pdf");

Open in new window


I have a requirement where I need to search a particular email in lotus notes through .NET code. Post to this, I would be sending text message if in case search finds the email.
Currently I am working on the first part where I am facing problem to connect with lotus notes through .net code. I am using below code -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
            Domino.NotesSession session = new Domino.NotesSession();
            Domino.NotesDatabase NotesDb = session.GetDatabase(session.ServerName, @"C:\notes\data\as_Sneha.nsf", false); //Open Notes Database
            //Domino.NotesView mailView = null;
           // mailView = NotesDb.GetView("($Inbox)");
            Domino.NotesDateTime _dateTime = session.CreateDateTime(DateTime.Now.ToString());

            // Domino.NotesDateTime _dateTime = session.CreateDateTime(String.Empty);
            Domino.NotesDocumentCollection collection = null;
            collection = NotesDb.Search("@Contains(Subject;'IBM')", _dateTime, 5000000);
           // collection.ReplaceItemValue("CALENDARDATETIME", _datetime.LSLocalTime); //maybe GetLSLocalTime...

            _lblNo.Text = "Total Number of Bounced Email(s)…
hi all
is any way to redirect to the main page after timeout is expired

 <sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="60" >

Open in new window

Oh dear experts
how to achive this

 mm.Body = Session("uno") & uno & "-" & dos & Session("dos") "< br />" Session("tres") & tres & "-" & cuatro & Session("cuatro")

Open in new window

var test1 = Convert.ToInt32(Session["SID"]);
Line 90:                       //  int ist = EAdapter.Insert(Convert.ToInt32(Session["SID"]), txtclgname.Text, txtErlno.Text,
Line 91:                         int ist=EAdapter.Insert(Convert.ToInt32(Session[test1]), txtclgname.Text, txtErlno.Text,
Line 92:                           drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text, drpPassyear.SelectedItem.Text,
Line 93:                           float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume);

Open in new window


I have downloaded tomcat 9 zip file and extracted to local windows laptop.

i then added as new server in eclipse by pointing to tomcat location.

when i start tomcat now getting below error

i see tomcat 8.5 download page

I do not see tomcat 8 download page.
how to resolve this

any  good video tutorials on this tomcat installationa nd integrating to eclipse
i hate window service installer version on my windows 10 laptop

Aug 11, 2017 11:29:22 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:hellows' did not find a matching property.
Aug 11, 2017 11:29:22 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/9.0.0.M26
Aug 11, 2017 11:29:22 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Aug 2 2017 20:29:05 UTC
Aug 11, 2017 11:29:22 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:
Aug 11, 2017 11:29:22 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Aug 11, 2017 11:29:22 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Aug 11, 2017 11:29:22 PM org.apache.catalina.startup.VersionLoggerListener log…
I have a c# application in (xaml) that runs when users log into a windows machine. The app is a popup form that maximizes and asks the user to click a button to continue. The behavior I want if for the user to NOT be able to do anything else until they click that button. Right now, users can bypass it by hitting the windows key, bringing up task manager and ending the app. If they start another app, it will start but they cannot see it as it is behind my form. They can also alt-tab out of it. Is there a way to basically freeze the use out of doing anything else until they click that button? Thanks for any help.
I am part of a development for a SOAP web services client on WCF/.NET. After a session of sending request, team for server side left feedback "extend someAction from schema i am mentioning below", and mentioned an URL. In this context, what does it mean to extend from schema?
Is Your Team Achieving Their Full Potential?
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

   protected void Page_Load(object sender, EventArgs e)

            CDT = Cadapter.SELECT_SEARCH_COMPANY(Session["JOBCATE"].ToString(), Session["QUALI"].ToString(), Session["skill"].ToString());
            if (CDT != null)
                if (CDT.Rows.Count > 0)
                    Session["CID"] = CDT.Rows[0]["CID"].ToString();
                    DataList3.DataSource = CDT;


Open in new window

How do you create a bar chart using Open XML?


Dan Lorenz
I am writing an application that is binded with a small Access Database. I have designed a report with RDLC (Visual Studio 2017) (VB.Net).
The report is design to be more of a form like, and not a table view if that makes any sense.

The issue I am having is that when I load the report I am not able to go through the records or reload it to the report. It only shows the first record in the dataset when it loads. I would like to choose what record or row is shown in the report.

Can this be done with some code on reportviewer form or load? A solution I thought of is showing the dataset in a datagridview and then allowing the user to select which row they want to do a report on. Click or select that row and then that record or row is loaded as the report.
I have a bug in my simple ASP.Net web application. To reproduce this, you have to Download the below solution.

Code Download

There is a SQL server .bak file which you need to restore. The connection string in web.config is already pointing to this database "Kentico10" which you are going to restore from .bak file.

Once you run the application it loads the default page "TestPage.aspx".

There is a tree view on this page. Initially, the tree view is collapsed for the level one.

If you try to expand any of the nodes in level one, it will hit the code behind file testpage.aspx.cs , RemoveAndAddChildNode function .

I put a break point at the Line number 282

This line will remove each child nodes of expanded node. and the next line will replace with a new node.

But the real issue is if we remove the child node using the above line. and if you try to expand any node, the node will never expand.it's being stuck there and not moves.

But try to comment the same line

"tn.ChildNodes.RemoveAt(nodeIndex); "
Expansion works.

But for replacing the nodes, first, i need to remove then I need to add.

So, please help me to expand the node without commenting line 282.
I have created a SmartDeviceProject in visual c#.
I have set Target platform "Windows mobile 5.0 pocket pc sdk" and
.net compact framework version 2.0.
After create project, i create installable cab file for symbol mc70.
I  installed it to mc70, it shows install successfully,
but when try to open from start up menu it gives error "This application (testproject.exe) requires a newer version of the microsoft compact framework than the version installed on this device".
Please tell me for mc70 which .net compact framework version is supported ?
Dear All,

I have a problem in calculating scrollbar position.

Issue: I have a Panel control (AutoScroll = True) inside which I have a control which change its size based on scrolwheel movement. (lets assume 1 tick at scroll - square control gets as much as doubled in size). What I want to achieve is to automatically scroll to the same position that mouse was pointing at before zoom. It's not as simple as using zoom factor, as the control inside the panel is bigger than panel.

I'd appreciate any advice.

Steps to reproduce:

- place panel and set autoscroll to true.
- place (lets say picturebox) inside a panel.
- implement any simple formula of changing size based on scrollwheel (ie. double size each step and make ~4 steps)

I want the scrollbars to update themselves after zooming (so the pointer is pointing at the same pixel on above's said picturebox) - I do not want to change pictures's box location - i want to achieve this by scrolls only.

I hope its clear. Thanks for any help given.

.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.