.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.  …
Enroll in August's Course of the Month
Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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)?

At work today where we support an SDK (.net one) someone asked if the C# SDK was a "signed" .NET SDK.

I wasn't 100% sure what they were talking about but I thought this was on the right track:

Can someone explain to me what this is about and why they would need it? And also how difficult would it be to turn my unsigned SDK into a signed SDK?

Thank you
Hi experts,
I have a colum in a table, filled with numbers of eight digits.  
Let me give you an example of the column:
I read, one by one, each row of this column with a SQLDaraReader loop
while (reader.Read())
                do the job 

Open in new window

I need to split each line  in two numbers :
- one is composed of the first two digits. In the first line of the example table it will be "01"
- the other is composed with the remaining part : in the example it will be 482021 ; 466587 ; 447852
I want, after reading all the lines, to find the MAX (or highest) value of the set " 482021 ; 466587 ; 447852 ; etc.)
I've tried a lot of combinations of split and parse without success.
Can someone help me ?
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?

while creating client from wsdl using web servicesw getting below error

public class CustomerOrdersWS {

      public static void main(String[] args) {
            // TODO Auto-generated method stub
            CustomerOrdersService service=new CustomerOrdersService(new URL{"http://localhost:8080/wsdlfirstws/services/customerOrders?wsdl"});



Multiple markers at this line
      - Type mismatch: cannot convert from String[] to
      - Syntax error on token(s), misplaced construct(s)
      - Syntax error on token ")", delete this token

i wonder what it mean by above error and how to resolve it please advise
Automating Terraform w Jenkins & AWS CodeCommit
Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

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 came across this site and it has the answer to the questions. I want to know why the answers are that.

   public class A
            public A()
                var p = "In A";

            static A()
                var p = "in Static A";

            public void Method()
                var p = "In Method A";


        public class B:A
            public B()
                var p = "In B";

            static B()
                var p = "in Static B";

            public void Method()
                var p = "In Method B";


Open in new window

1. A a = new A();  -- Why does it call the "In static A" first and then "In A"?  Static methods can't be called with "new"

2. B b = new A();  -- why is this an error? B inherits from A

3. A c = new B();  -- this calls "in static B" first, then "in Static A", then "In A" and then "In B".  Same as #1. Why is it calling "static" method first?  It inherits from A ...that's why it calls "in Static A", then "In A" next, correct?

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
I have:
action="https://test.secure.touchnet.net:8443/****.jsp" method="post" target="_self" id="hidden_calc"
<input type="hidden" name="UPAY_SITE_ID" value="*">
<input type="hidden" name="EXT_TRANS_ID" value="whatever">

I need to add
<input type = "hidden" name = "BILL_NAME" value = "aName">
<input type = "hidden" email = "email" value = "aName@gmail.com">

I need to have this all run in the code behind.

any help will be appreciated
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 have a simple  .Net web form that submits to a SQL Server Stored Procedure

In the stored procedure I insert a persons data into the Individuals table

I am currently setting the following
.... Insert form data to table.....

SET @IndividualID = @@Identity()

I then use that Variable to insert into additional sub tables

Is @@Identity correct?
Or should it use Scope_Identity?

It also returns @IndividualID to the Form.
That is not used elsewhere but just with a If CInt(dR("IndividualID").ToString()) > 0
TO let us know the data was inserted with no error
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)…
Use Filtering Commands to Process Files in Linux
Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

I'm trying to write a program that remains responsive when it's performing some ftp operations.  Do I use Parallel Programming or Async/Await to make the happen?

Can you provide an example?
I am learning ASP.NET Core using somebooks and tutorial, but nearly all of them use a localdb for the database. I would like to create the database into the local Instance of SQLServer Installed on my machine and need help with the syntax for providing the connection string for this purpse.
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
             // This is the connection string I am using currently for mssqllocaldb
             optionsBuilder.UseSqlServer("Server = (localdb)\\mssqllocaldb; Database = BookPost; Trusted_Connection = True; ");
            //  This is the connection string that use I a WPF application to connect to SQLServer intance on my machine
    //< add name = "LibraryEntities" connectionString = "metadata=res://*/Fish.csdl|res://*/Fish.ssdl|res://*/Fish.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=FAHEEMPC\SQLEXPRESS;initial catalog=Library security info=True;user id=sa;password=abcepassword;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName = "System.Data.EntityClient" />


Open in new window

Thank you for your help.
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

Users are experiencing an issue when uploading CSV files. The issue is if the user modifies the date colum(s) to a short date (01/01/2099) a datetime string error is thrown. Secondly, if a user changes the value of the Active column to False it still shows as True on page refresh. I am hoping that the .ToLongDateString will help for the date issue.

Public Class ManageEvents
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then

            If HasAccessToEventImportExport() Then
                panelEventImportExport.Visible = True
            End If
        End If
    End Sub

    Protected Sub SetPermissions()
        Dim lst As New List(Of AssignedPermission.PermissionType)
        lst = CType(Session("Permissions"), List(Of AssignedPermission.PermissionType))
        If Not lst.Contains(AssignedPermission.PermissionType.ManageServices) Then
        End If
    End Sub

    Protected Sub SelectEvents()
        Dim Serv As New Events()
        gvwEvents.DataSource = Serv.SelectAllEvents()
    End Sub

    Private Sub gvwEvents_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvwEvents.DataBound
    End Sub

    Private Sub gvwEvents_PageIndexChanging(ByVal sender As Object, ByVal e As 

Open in new window

hi all i cant get the cc to my cod, mark error in the cc line,
any advice for add cc!
regards you experts

 Dim mm As New MailMessage("info@talssdssfesms.com", txtEmail)
        mm.Subject = "Registro Quiniela NFL"
        mm.Body = "Username:  " & username & "<br /> Password:  " & password & "<br /> "
        mm.CC= "sdjsdssj@gmail.com"
        mm.IsBodyHtml = True
        Dim smtp As New SmtpClient()
        smtp.Host = "smtp.lisdspsa-indussdftrial.com"
        smtp.EnableSsl = False
        Dim NetworkCred As New System.Net.NetworkCredential()
        NetworkCred.UserName = "edeobadsdsldia@dsds-indsdsdustrial.com"
        NetworkCred.Password = "sdsdkksdskds"
        smtp.UseDefaultCredentials = True
        smtp.Credentials = NetworkCred
        smtp.Port = 25
        Catch ex As Exception
        End Try

Open in new window


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